|
@@ -97,15 +97,15 @@ console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotati
|
|
|
b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,n=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=n+k*c,b[1]=k+n*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,n=c*h,p=c*e,b[0]=g*h,b[4]=n*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-n,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,n=c*g,p=c*d,b[0]=g*h,b[4]=p-a*e,b[8]=n*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+n,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,n=c*g,p=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*
|
|
|
e-n,b[2]=n*e-k,b[6]=c*h,b[10]=p*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,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var n=c*h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=n-f;b[8]=c+h;b[1]=n+f;b[5]=1-
|
|
|
(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[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,f=c[0],g=c[4],h=c[8],k=c[12],n=c[1],p=c[5],q=c[9],m=c[13],t=c[2],s=c[6],r=c[10],u=c[14],w=c[3],x=c[7],L=c[11],c=c[15],v=d[0],y=d[4],z=d[8],C=d[12],G=d[1],E=d[5],D=d[9],I=d[13],U=d[2],M=d[6],J=d[10],K=d[14],O=d[3],
|
|
|
-V=d[7],F=d[11],d=d[15];e[0]=f*v+g*G+h*U+k*O;e[4]=f*y+g*E+h*M+k*V;e[8]=f*z+g*D+h*J+k*F;e[12]=f*C+g*I+h*K+k*d;e[1]=n*v+p*G+q*U+m*O;e[5]=n*y+p*E+q*M+m*V;e[9]=n*z+p*D+q*J+m*F;e[13]=n*C+p*I+q*K+m*d;e[2]=t*v+s*G+r*U+u*O;e[6]=t*y+s*E+r*M+u*V;e[10]=t*z+s*D+r*J+u*F;e[14]=t*C+s*I+r*K+u*d;e[3]=w*v+x*G+L*U+c*O;e[7]=w*y+x*E+L*M+c*V;e[11]=w*z+x*D+L*J+c*F;e[15]=w*C+x*I+L*K+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]=
|
|
|
+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,f=c[0],g=c[4],h=c[8],k=c[12],n=c[1],p=c[5],q=c[9],m=c[13],t=c[2],s=c[6],r=c[10],u=c[14],v=c[3],y=c[7],L=c[11],c=c[15],x=d[0],E=d[4],z=d[8],F=d[12],D=d[1],w=d[5],C=d[9],A=d[13],U=d[2],M=d[6],I=d[10],K=d[14],N=d[3],
|
|
|
+T=d[7],P=d[11],d=d[15];e[0]=f*x+g*D+h*U+k*N;e[4]=f*E+g*w+h*M+k*T;e[8]=f*z+g*C+h*I+k*P;e[12]=f*F+g*A+h*K+k*d;e[1]=n*x+p*D+q*U+m*N;e[5]=n*E+p*w+q*M+m*T;e[9]=n*z+p*C+q*I+m*P;e[13]=n*F+p*A+q*K+m*d;e[2]=t*x+s*D+r*U+u*N;e[6]=t*E+s*w+r*M+u*T;e[10]=t*z+s*C+r*I+u*P;e[14]=t*F+s*A+r*K+u*d;e[3]=v*x+y*D+L*U+c*N;e[7]=v*E+y*w+L*M+c*T;e[11]=v*z+y*C+L*I+c*P;e[15]=v*F+y*A+L*K+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=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=
|
|
|
b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix4(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=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],f=a[1],g=a[5],h=a[9],k=a[13],n=a[2],p=a[6],q=a[10],m=a[14];return a[3]*(+e*h*p-d*k*p-e*g*q+c*k*q+d*g*m-c*h*m)+a[7]*(+b*h*m-b*k*q+e*f*q-d*f*m+d*k*n-e*h*n)+a[11]*(+b*k*p-b*g*m-e*f*p+c*f*m+e*g*n-c*k*n)+a[15]*(-d*g*n-b*h*p+b*g*q+d*f*p-c*f*q+c*h*n)},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=new THREE.Vector3;return function(){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],f=d[4],g=d[8],h=d[12],k=d[1],n=d[5],p=d[9],q=d[13],m=d[2],t=d[6],s=d[10],r=d[14],u=d[3],w=d[7],x=d[11],d=d[15];c[0]=p*r*w-q*s*w+q*t*x-n*r*x-p*t*d+n*s*d;c[4]=h*s*w-g*r*w-h*t*x+f*r*x+g*t*d-f*s*d;c[8]=g*q*w-h*p*w+h*n*x-f*q*x-g*n*d+f*p*d;c[12]=h*p*t-g*q*t-h*n*s+f*q*s+g*n*r-f*p*r;c[1]=q*s*u-p*r*u-q*m*x+k*r*x+p*m*d-k*s*d;c[5]=g*r*u-h*s*u+h*m*x-e*r*x-g*m*d+e*s*d;c[9]=h*p*u-g*q*u-h*k*
|
|
|
-x+e*q*x+g*k*d-e*p*d;c[13]=g*q*m-h*p*m+h*k*s-e*q*s-g*k*r+e*p*r;c[2]=n*r*u-q*t*u+q*m*w-k*r*w-n*m*d+k*t*d;c[6]=h*t*u-f*r*u-h*m*w+e*r*w+f*m*d-e*t*d;c[10]=f*q*u-h*n*u+h*k*w-e*q*w-f*k*d+e*n*d;c[14]=h*n*m-f*q*m-h*k*t+e*q*t+f*k*r-e*n*r;c[3]=p*t*u-n*s*u-p*m*w+k*s*w+n*m*x-k*t*x;c[7]=f*s*u-g*t*u+g*m*w-e*s*w-f*m*x+e*t*x;c[11]=g*n*u-f*p*u-g*k*w+e*p*w+f*k*x-e*n*x;c[15]=f*p*m-g*n*m+g*k*t-e*p*t-f*k*s+e*n*s;c=e*c[0]+k*c[4]+m*c[8]+u*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
+this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],k=d[1],n=d[5],p=d[9],q=d[13],m=d[2],t=d[6],s=d[10],r=d[14],u=d[3],v=d[7],y=d[11],d=d[15];c[0]=p*r*v-q*s*v+q*t*y-n*r*y-p*t*d+n*s*d;c[4]=h*s*v-g*r*v-h*t*y+f*r*y+g*t*d-f*s*d;c[8]=g*q*v-h*p*v+h*n*y-f*q*y-g*n*d+f*p*d;c[12]=h*p*t-g*q*t-h*n*s+f*q*s+g*n*r-f*p*r;c[1]=q*s*u-p*r*u-q*m*y+k*r*y+p*m*d-k*s*d;c[5]=g*r*u-h*s*u+h*m*y-e*r*y-g*m*d+e*s*d;c[9]=h*p*u-g*q*u-h*k*
|
|
|
+y+e*q*y+g*k*d-e*p*d;c[13]=g*q*m-h*p*m+h*k*s-e*q*s-g*k*r+e*p*r;c[2]=n*r*u-q*t*u+q*m*v-k*r*v-n*m*d+k*t*d;c[6]=h*t*u-f*r*u-h*m*v+e*r*v+f*m*d-e*t*d;c[10]=f*q*u-h*n*u+h*k*v-e*q*v-f*k*d+e*n*d;c[14]=h*n*m-f*q*m-h*k*t+e*q*t+f*k*r-e*n*r;c[3]=p*t*u-n*s*u-p*m*v+k*s*v+n*m*y-k*t*y;c[7]=f*s*u-g*t*u+g*m*v-e*s*v-f*m*y+e*t*y;c[11]=g*n*u-f*p*u-g*k*v+e*p*v+f*k*y-e*n*y;c[15]=f*p*m-g*n*m+g*k*t-e*p*t-f*k*s+e*n*s;c=e*c[0]+k*c[4]+m*c[8]+u*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(a){console.warn("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){console.warn("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){console.warn("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){console.warn("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(a,b){console.warn("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,f=a.x,g=a.y,h=a.z,k=e*f,n=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,n*g+c,n*h-d*f,0,k*h-d*g,n*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
@@ -181,17 +181,17 @@ THREE.Uint32Attribute=function(a,b){console.warn("THREE.Uint32Attribute has been
|
|
|
THREE.Float64Attribute=function(a,b){console.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.attributes={};this.attributesKeys=[];this.offsets=this.drawcalls=[];this.boundingSphere=this.boundingBox=null};
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[a]={array:b,itemSize:c}):(this.attributes[a]=b,this.attributesKeys=Object.keys(this.attributes))},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.drawcalls.push({start:a,count:b,index:void 0!==c?c:0})},applyMatrix:function(a){var b=
|
|
|
this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0)},center:function(){},fromGeometry:function(a,b){b=b||{vertexColors:THREE.NoColors};var c=a.vertices,d=a.faces,e=a.faceVertexUvs,f=b.vertexColors,g=0<e[0].length,h=3==d[0].vertexNormals.length,k=new Float32Array(9*d.length);this.addAttribute("position",new THREE.BufferAttribute(k,3));var n=
|
|
|
-new Float32Array(9*d.length);this.addAttribute("normal",new THREE.BufferAttribute(n,3));if(f!==THREE.NoColors){var p=new Float32Array(9*d.length);this.addAttribute("color",new THREE.BufferAttribute(p,3))}if(!0===g){var q=new Float32Array(6*d.length);this.addAttribute("uv",new THREE.BufferAttribute(q,2))}for(var m=0,t=0,s=0;m<d.length;m++,t+=6,s+=9){var r=d[m],u=c[r.a],w=c[r.b],x=c[r.c];k[s]=u.x;k[s+1]=u.y;k[s+2]=u.z;k[s+3]=w.x;k[s+4]=w.y;k[s+5]=w.z;k[s+6]=x.x;k[s+7]=x.y;k[s+8]=x.z;!0===h?(u=r.vertexNormals[0],
|
|
|
-w=r.vertexNormals[1],x=r.vertexNormals[2],n[s]=u.x,n[s+1]=u.y,n[s+2]=u.z,n[s+3]=w.x,n[s+4]=w.y,n[s+5]=w.z,n[s+6]=x.x,n[s+7]=x.y,n[s+8]=x.z):(u=r.normal,n[s]=u.x,n[s+1]=u.y,n[s+2]=u.z,n[s+3]=u.x,n[s+4]=u.y,n[s+5]=u.z,n[s+6]=u.x,n[s+7]=u.y,n[s+8]=u.z);f===THREE.FaceColors?(r=r.color,p[s]=r.r,p[s+1]=r.g,p[s+2]=r.b,p[s+3]=r.r,p[s+4]=r.g,p[s+5]=r.b,p[s+6]=r.r,p[s+7]=r.g,p[s+8]=r.b):f===THREE.VertexColors&&(u=r.vertexColors[0],w=r.vertexColors[1],r=r.vertexColors[2],p[s]=u.r,p[s+1]=u.g,p[s+2]=u.b,p[s+3]=
|
|
|
-w.r,p[s+4]=w.g,p[s+5]=w.b,p[s+6]=r.r,p[s+7]=r.g,p[s+8]=r.b);!0===g&&(r=e[0][m][0],u=e[0][m][1],w=e[0][m][2],q[t]=r.x,q[t+1]=r.y,q[t+2]=u.x,q[t+3]=u.y,q[t+4]=w.x,q[t+5]=w.y)}this.computeBoundingSphere();return this},computeBoundingBox:function(){var a=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var b=this.attributes.position.array;if(b){var c=this.boundingBox;c.makeEmpty();for(var d=0,e=b.length;d<e;d+=3)a.set(b[d],b[d+1],b[d+2]),c.expandByPoint(a)}if(void 0===
|
|
|
+new Float32Array(9*d.length);this.addAttribute("normal",new THREE.BufferAttribute(n,3));if(f!==THREE.NoColors){var p=new Float32Array(9*d.length);this.addAttribute("color",new THREE.BufferAttribute(p,3))}if(!0===g){var q=new Float32Array(6*d.length);this.addAttribute("uv",new THREE.BufferAttribute(q,2))}for(var m=0,t=0,s=0;m<d.length;m++,t+=6,s+=9){var r=d[m],u=c[r.a],v=c[r.b],y=c[r.c];k[s]=u.x;k[s+1]=u.y;k[s+2]=u.z;k[s+3]=v.x;k[s+4]=v.y;k[s+5]=v.z;k[s+6]=y.x;k[s+7]=y.y;k[s+8]=y.z;!0===h?(u=r.vertexNormals[0],
|
|
|
+v=r.vertexNormals[1],y=r.vertexNormals[2],n[s]=u.x,n[s+1]=u.y,n[s+2]=u.z,n[s+3]=v.x,n[s+4]=v.y,n[s+5]=v.z,n[s+6]=y.x,n[s+7]=y.y,n[s+8]=y.z):(u=r.normal,n[s]=u.x,n[s+1]=u.y,n[s+2]=u.z,n[s+3]=u.x,n[s+4]=u.y,n[s+5]=u.z,n[s+6]=u.x,n[s+7]=u.y,n[s+8]=u.z);f===THREE.FaceColors?(r=r.color,p[s]=r.r,p[s+1]=r.g,p[s+2]=r.b,p[s+3]=r.r,p[s+4]=r.g,p[s+5]=r.b,p[s+6]=r.r,p[s+7]=r.g,p[s+8]=r.b):f===THREE.VertexColors&&(u=r.vertexColors[0],v=r.vertexColors[1],r=r.vertexColors[2],p[s]=u.r,p[s+1]=u.g,p[s+2]=u.b,p[s+3]=
|
|
|
+v.r,p[s+4]=v.g,p[s+5]=v.b,p[s+6]=r.r,p[s+7]=r.g,p[s+8]=r.b);!0===g&&(r=e[0][m][0],u=e[0][m][1],v=e[0][m][2],q[t]=r.x,q[t+1]=r.y,q[t+2]=u.x,q[t+3]=u.y,q[t+4]=v.x,q[t+5]=v.y)}this.computeBoundingSphere();return this},computeBoundingBox:function(){var a=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var b=this.attributes.position.array;if(b){var c=this.boundingBox;c.makeEmpty();for(var d=0,e=b.length;d<e;d+=3)a.set(b[d],b[d+1],b[d+2]),c.expandByPoint(a)}if(void 0===
|
|
|
b||0===b.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;
|
|
|
if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=
|
|
|
this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,f,g,h,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3;if(a.index)for(var t=a.index.array,s=0<this.offsets.length?this.offsets:[{start:0,count:t.length,index:0}],r=0,u=s.length;r<u;++r){e=s[r].start;f=s[r].count;
|
|
|
-for(var w=s[r].index,d=e,e=e+f;d<e;d+=3)f=3*(w+t[d]),g=3*(w+t[d+1]),h=3*(w+t[d+2]),k.fromArray(b,f),n.fromArray(b,g),p.fromArray(b,h),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[f]+=q.x,c[f+1]+=q.y,c[f+2]+=q.z,c[g]+=q.x,c[g+1]+=q.y,c[g+2]+=q.z,c[h]+=q.x,c[h+1]+=q.y,c[h+2]+=q.z}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),n.fromArray(b,d+3),p.fromArray(b,d+6),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[d]=q.x,c[d+1]=q.y,c[d+2]=q.z,c[d+3]=q.x,c[d+4]=q.y,c[d+5]=q.z,c[d+6]=q.x,c[d+7]=q.y,
|
|
|
-c[d+8]=q.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q.fromArray(d,3*a);m.fromArray(d,3*b);t.fromArray(d,3*c);s.fromArray(f,2*a);r.fromArray(f,2*b);u.fromArray(f,2*c);w=m.x-q.x;x=t.x-q.x;L=m.y-q.y;v=t.y-q.y;y=m.z-q.z;z=t.z-q.z;C=r.x-s.x;G=u.x-s.x;E=r.y-s.y;D=u.y-s.y;I=1/(C*D-G*E);U.set((D*w-E*x)*I,(D*L-E*v)*I,(D*y-E*z)*I);M.set((C*x-G*w)*I,(C*v-G*L)*I,(C*z-G*y)*I);k[a].add(U);k[b].add(U);k[c].add(U);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){ta.fromArray(e,
|
|
|
-3*a);Q.copy(ta);qa=k[a];pa.copy(qa);pa.sub(ta.multiplyScalar(ta.dot(qa))).normalize();ba.crossVectors(Q,qa);Ga=ba.dot(n[a]);La=0>Ga?-1:1;h[4*a]=pa.x;h[4*a+1]=pa.y;h[4*a+2]=pa.z;h[4*a+3]=La}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,
|
|
|
-e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<g;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var q=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,w,x,L,v,y,z,C,G,E,D,I,U=new THREE.Vector3,M=new THREE.Vector3,J,K,O,V,F;0===this.drawcalls.length&&
|
|
|
-this.addDrawCall(0,c.length,0);var N=this.drawcalls,p=0;for(K=N.length;p<K;++p){J=N[p].start;O=N[p].count;var R=N[p].index,g=J;for(J+=O;g<J;g+=3)O=R+c[g],V=R+c[g+1],F=R+c[g+2],a(O,V,F)}var pa=new THREE.Vector3,ba=new THREE.Vector3,ta=new THREE.Vector3,Q=new THREE.Vector3,La,qa,Ga,p=0;for(K=N.length;p<K;++p)for(J=N[p].start,O=N[p].count,R=N[p].index,g=J,J+=O;g<J;g+=3)O=R+c[g],V=R+c[g+1],F=R+c[g+2],b(O),b(V),b(F)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
|
|
|
+for(var v=s[r].index,d=e,e=e+f;d<e;d+=3)f=3*(v+t[d]),g=3*(v+t[d+1]),h=3*(v+t[d+2]),k.fromArray(b,f),n.fromArray(b,g),p.fromArray(b,h),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[f]+=q.x,c[f+1]+=q.y,c[f+2]+=q.z,c[g]+=q.x,c[g+1]+=q.y,c[g+2]+=q.z,c[h]+=q.x,c[h+1]+=q.y,c[h+2]+=q.z}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),n.fromArray(b,d+3),p.fromArray(b,d+6),q.subVectors(p,n),m.subVectors(k,n),q.cross(m),c[d]=q.x,c[d+1]=q.y,c[d+2]=q.z,c[d+3]=q.x,c[d+4]=q.y,c[d+5]=q.z,c[d+6]=q.x,c[d+7]=q.y,
|
|
|
+c[d+8]=q.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q.fromArray(d,3*a);m.fromArray(d,3*b);t.fromArray(d,3*c);s.fromArray(f,2*a);r.fromArray(f,2*b);u.fromArray(f,2*c);v=m.x-q.x;y=t.x-q.x;L=m.y-q.y;x=t.y-q.y;E=m.z-q.z;z=t.z-q.z;F=r.x-s.x;D=u.x-s.x;w=r.y-s.y;C=u.y-s.y;A=1/(F*C-D*w);U.set((C*v-w*y)*A,(C*L-w*x)*A,(C*E-w*z)*A);M.set((F*y-D*v)*A,(F*x-D*L)*A,(F*z-D*E)*A);k[a].add(U);k[b].add(U);k[c].add(U);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){Ba.fromArray(e,
|
|
|
+3*a);G.copy(Ba);qa=k[a];pa.copy(qa);pa.sub(Ba.multiplyScalar(Ba.dot(qa))).normalize();ca.crossVectors(G,qa);La=ca.dot(n[a]);wa=0>La?-1:1;h[4*a]=pa.x;h[4*a+1]=pa.y;h[4*a+2]=pa.z;h[4*a+3]=wa}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,
|
|
|
+e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<g;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var q=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,v,y,L,x,E,z,F,D,w,C,A,U=new THREE.Vector3,M=new THREE.Vector3,I,K,N,T,P;0===this.drawcalls.length&&
|
|
|
+this.addDrawCall(0,c.length,0);var X=this.drawcalls,p=0;for(K=X.length;p<K;++p){I=X[p].start;N=X[p].count;var Q=X[p].index,g=I;for(I+=N;g<I;g+=3)N=Q+c[g],T=Q+c[g+1],P=Q+c[g+2],a(N,T,P)}var pa=new THREE.Vector3,ca=new THREE.Vector3,Ba=new THREE.Vector3,G=new THREE.Vector3,wa,qa,La,p=0;for(K=X.length;p<K;++p)for(I=X[p].start,N=X[p].count,Q=X[p].index,g=I,I+=N;g<I;g+=3)N=Q+c[g],T=Q+c[g+1],P=Q+c[g+2],b(N),b(T),b(P)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
|
|
|
for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],n=0,p=0,q=new Int32Array(6),m=new Int32Array(c.length),t=new Int32Array(c.length),s=0;s<c.length;s++)m[s]=-1,t[s]=-1;for(c=0;c<d;c++){for(var r=p=0;3>r;r++)s=a[3*c+r],-1==m[s]?(q[2*r]=s,q[2*r+1]=-1,p++):m[s]<k.index?(q[2*r]=s,q[2*r+1]=-1,n++):(q[2*r]=s,q[2*r+1]=m[s]);if(g+p>k.index+b)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)r=q[p+1],-1<r&&r<k.index&&(q[p+1]=
|
|
|
-1);for(p=0;6>p;p+=2)s=q[p],r=q[p+1],-1===r&&(r=g++),m[s]=r,t[r]=s,e[f++]=r-k.index,k.count++}this.reorderBuffers(e,t,g);return this.offsets=h},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,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}},
|
|
|
normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},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 f=0;f<c;f++){var g=b[f];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,n=d[e],p=0;p<k;p++)n[f*k+p]=h[g*
|
|
@@ -207,16 +207,16 @@ g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(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],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[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 f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g=
|
|
|
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),g.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.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,f,g,h,k,n,p,q,m,t,s,r,u,w=[],x=[];c=new THREE.Vector3;var L=new THREE.Vector3,v=new THREE.Vector3,y=new THREE.Vector3,z=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,x[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e],
|
|
|
-n=f[0],p=f[1],q=f[2],f=h.x-g.x,m=k.x-g.x,t=h.y-g.y,s=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-n.x,r=q.x-n.x,p=p.y-n.y,n=q.y-n.y,q=1/(k*n-r*p),c.set((n*f-p*m)*q,(n*t-p*s)*q,(n*h-p*g)*q),L.set((k*m-r*f)*q,(k*s-r*t)*q,(k*g-r*h)*q),w[d].add(c),w[u].add(c),w[e].add(c),x[d].add(L),x[u].add(L),x[e].add(L);L=["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++)z.copy(e.vertexNormals[c]),d=e[L[c]],u=w[d],v.copy(u),v.sub(z.multiplyScalar(z.dot(u))).normalize(),
|
|
|
-y.crossVectors(e.vertexNormals[c],u),d=y.dot(x[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(v.x,v.y,v.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);
|
|
|
+d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v=[],y=[];c=new THREE.Vector3;var L=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3,z=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,y[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e],
|
|
|
+n=f[0],p=f[1],q=f[2],f=h.x-g.x,m=k.x-g.x,t=h.y-g.y,s=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-n.x,r=q.x-n.x,p=p.y-n.y,n=q.y-n.y,q=1/(k*n-r*p),c.set((n*f-p*m)*q,(n*t-p*s)*q,(n*h-p*g)*q),L.set((k*m-r*f)*q,(k*s-r*t)*q,(k*g-r*h)*q),v[d].add(c),v[u].add(c),v[e].add(c),y[d].add(L),y[u].add(L),y[e].add(L);L=["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++)z.copy(e.vertexNormals[c]),d=e[L[c]],u=v[d],x.copy(u),x.sub(z.multiplyScalar(z.dot(u))).normalize(),
|
|
|
+E.crossVectors(e.vertexNormals[c],u),d=E.dot(y[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,f=this.vertices,g=a.vertices,h=this.faces,k=a.faces,n=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var p=0,q=g.length;p<q;p++){var m=g[p].clone();void 0!==b&&m.applyMatrix4(b);f.push(m)}p=0;for(q=k.length;p<
|
|
|
q;p++){var g=k[p],t,s=g.vertexNormals,r=g.vertexColors,m=new THREE.Face3(g.a+e,g.b+e,g.c+e);m.normal.copy(g.normal);void 0!==d&&m.normal.applyMatrix3(d).normalize();b=0;for(f=s.length;b<f;b++)t=s[b].clone(),void 0!==d&&t.applyMatrix3(d).normalize(),m.vertexNormals.push(t);m.color.copy(g.color);b=0;for(f=r.length;b<f;b++)t=r[b],m.vertexColors.push(t.clone());m.materialIndex=g.materialIndex+c;h.push(m)}p=0;for(q=a.length;p<q;p++)if(c=a[p],d=[],void 0!==c){b=0;for(f=c.length;b<f;b++)d.push(c[b].clone());
|
|
|
n.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),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<
|
|
|
g;f++)for(e=this.faces[f],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(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},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!==n[b])return n[b];n[b]=k.length/3;k.push(a.x,a.y,
|
|
|
a.z);return n[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==q[b])return q[b];q[b]=p.length;p.push(a.getHex());return q[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==t[b])return t[b];t[b]=m.length/2;m.push(a.x,a.y);return t[b]}var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!==
|
|
|
-f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],n={},p=[],q={},m=[],t={};for(g=0;g<this.faces.length;g++){var s=this.faces[g],r=void 0!==this.faceVertexUvs[0][g],u=0<s.normal.length(),w=0<s.vertexNormals.length,x=1!==s.color.r||1!==s.color.g||1!==s.color.b,L=0<s.vertexColors.length,v=0,v=a(v,0,0),v=a(v,1,!1),v=a(v,2,!1),v=a(v,3,r),v=a(v,4,u),v=a(v,5,w),v=a(v,6,x),v=a(v,7,L);h.push(v);h.push(s.a,s.b,s.c);r&&(r=this.faceVertexUvs[0][g],
|
|
|
-h.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(s.normal));w&&(u=s.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));x&&h.push(c(s.color));L&&(s=s.vertexColors,h.push(c(s[0]),c(s[1]),c(s[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];
|
|
|
+f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],n={},p=[],q={},m=[],t={};for(g=0;g<this.faces.length;g++){var s=this.faces[g],r=void 0!==this.faceVertexUvs[0][g],u=0<s.normal.length(),v=0<s.vertexNormals.length,y=1!==s.color.r||1!==s.color.g||1!==s.color.b,L=0<s.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,v),x=a(x,6,y),x=a(x,7,L);h.push(x);h.push(s.a,s.b,s.c);r&&(r=this.faceVertexUvs[0][g],
|
|
|
+h.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(s.normal));v&&(u=s.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));y&&h.push(c(s.color));L&&(s=s.vertexColors,h.push(c(s[0]),c(s[1]),c(s[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];
|
|
|
c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Camera=function(){THREE.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.getWorldDirection=function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,-1).applyQuaternion(a)}}();THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};
|
|
@@ -246,8 +246,8 @@ this.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.
|
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.imageLoader=new THREE.ImageLoader;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/a.total).toFixed(0)+
|
|
|
"%"):b+((a.loaded/1024).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=this.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function d(a,
|
|
|
-d,e,g,h,k,r){var u=b+e,w,x=THREE.Loader.Handlers.get(u);null!==x?w=x.load(u):(w=new THREE.Texture,x=f.imageLoader,x.crossOrigin=f.crossOrigin,x.load(u,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=c(a.width),d=c(a.height),e=document.createElement("canvas");e.width=b;e.height=d;e.getContext("2d").drawImage(a,0,0,b,d);w.image=e}else w.image=a;w.needsUpdate=!0}));w.sourceFile=e;g&&(w.repeat.set(g[0],g[1]),1!==g[0]&&(w.wrapS=THREE.RepeatWrapping),
|
|
|
-1!==g[1]&&(w.wrapT=THREE.RepeatWrapping));h&&w.offset.set(h[0],h[1]);k&&(e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==e[k[0]]&&(w.wrapS=e[k[0]]),void 0!==e[k[1]]&&(w.wrapT=e[k[1]]));r&&(w.anisotropy=r);a[d]=w}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var f=this,g="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":
|
|
|
+d,e,g,h,k,r){var u=b+e,v,y=THREE.Loader.Handlers.get(u);null!==y?v=y.load(u):(v=new THREE.Texture,y=f.imageLoader,y.crossOrigin=f.crossOrigin,y.load(u,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=c(a.width),d=c(a.height),e=document.createElement("canvas");e.width=b;e.height=d;e.getContext("2d").drawImage(a,0,0,b,d);v.image=e}else v.image=a;v.needsUpdate=!0}));v.sourceFile=e;g&&(v.repeat.set(g[0],g[1]),1!==g[0]&&(v.wrapS=THREE.RepeatWrapping),
|
|
|
+1!==g[1]&&(v.wrapT=THREE.RepeatWrapping));h&&v.offset.set(h[0],h[1]);k&&(e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==e[k[0]]&&(v.wrapS=e[k[0]]),void 0!==e[k[1]]&&(v.wrapT=e[k[1]]));r&&(v.anisotropy=r);a[d]=v}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var f=this,g="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":
|
|
|
"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(h.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)h.transparent=a.transparent;void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===
|
|
|
a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorAmbient&&(h.ambient=e(a.colorAmbient));a.colorEmissive&&(h.emissive=e(a.colorEmissive));a.transparency&&(h.opacity=a.transparency);a.specularCoef&&(h.shininess=a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,
|
|
|
a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapAlpha&&
|
|
@@ -260,10 +260,10 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d
|
|
|
a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);if(void 0!==h.metadata&&"scene"===h.metadata.type){console.error('THREE.JSONLoader: "'+b+'" seems to be a Scene. Use THREE.SceneLoader instead.');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error('THREE.JSONLoader: "'+b+'" seems to be unreachable or the file is empty.');
|
|
|
a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+b+'" ('+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,n,p,q,m,t,s,r,u,w,x=a.faces;p=a.vertices;var L=a.normals,v=a.colors,y=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&y++;for(d=0;d<y;d++)c.faceVertexUvs[d]=[]}k=0;for(n=p.length;k<n;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(n=x.length;k<n;)if(b=x[k++],t=b&1,h=b&2,d=b&8,q=b&16,s=b&32,p=b&64,b&=128,t){t=new THREE.Face3;
|
|
|
-t.a=x[k];t.b=x[k+1];t.c=x[k+3];r=new THREE.Face3;r.a=x[k+1];r.b=x[k+2];r.c=x[k+3];k+=4;h&&(h=x[k++],t.materialIndex=h,r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<y;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)m=x[k++],w=u[2*m],m=u[2*m+1],w=new THREE.Vector2(w,m),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*x[k++],t.normal.set(L[q++],L[q++],L[q]),r.normal.copy(t.normal));if(s)for(d=0;4>d;d++)q=3*x[k++],s=new THREE.Vector3(L[q++],
|
|
|
-L[q++],L[q]),2!==d&&t.vertexNormals.push(s),0!==d&&r.vertexNormals.push(s);p&&(p=x[k++],p=v[p],t.color.setHex(p),r.color.setHex(p));if(b)for(d=0;4>d;d++)p=x[k++],p=v[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&r.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(r)}else{t=new THREE.Face3;t.a=x[k++];t.b=x[k++];t.c=x[k++];h&&(h=x[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<y;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=x[k++],w=u[2*m],m=u[2*m+1],
|
|
|
-w=new THREE.Vector2(w,m),c.faceVertexUvs[d][h].push(w);q&&(q=3*x[k++],t.normal.set(L[q++],L[q++],L[q]));if(s)for(d=0;3>d;d++)q=3*x[k++],s=new THREE.Vector3(L[q++],L[q++],L[q]),t.vertexNormals.push(s);p&&(p=x[k++],t.color.setHex(v[p]));if(b)for(d=0;3>d;d++)p=x[k++],t.vertexColors.push(new THREE.Color(v[p]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,n,p,q,m,t,s,r,u,v,y=a.faces;p=a.vertices;var L=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(n=p.length;k<n;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(n=y.length;k<n;)if(b=y[k++],t=b&1,h=b&2,d=b&8,q=b&16,s=b&32,p=b&64,b&=128,t){t=new THREE.Face3;
|
|
|
+t.a=y[k];t.b=y[k+1];t.c=y[k+3];r=new THREE.Face3;r.a=y[k+1];r.b=y[k+2];r.c=y[k+3];k+=4;h&&(h=y[k++],t.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]=[],g=0;4>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],v=new THREE.Vector2(v,m),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);q&&(q=3*y[k++],t.normal.set(L[q++],L[q++],L[q]),r.normal.copy(t.normal));if(s)for(d=0;4>d;d++)q=3*y[k++],s=new THREE.Vector3(L[q++],
|
|
|
+L[q++],L[q]),2!==d&&t.vertexNormals.push(s),0!==d&&r.vertexNormals.push(s);p&&(p=y[k++],p=x[p],t.color.setHex(p),r.color.setHex(p));if(b)for(d=0;4>d;d++)p=y[k++],p=x[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&r.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(r)}else{t=new THREE.Face3;t.a=y[k++];t.b=y[k++];t.c=y[k++];h&&(h=y[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=y[k++],v=u[2*m],m=u[2*m+1],
|
|
|
+v=new THREE.Vector2(v,m),c.faceVertexUvs[d][h].push(v);q&&(q=3*y[k++],t.normal.set(L[q++],L[q++],L[q]));if(s)for(d=0;3>d;d++)q=3*y[k++],s=new THREE.Vector3(L[q++],L[q++],L[q]),t.vertexNormals.push(s);p&&(p=y[k++],t.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=y[k++],t.vertexColors.push(new THREE.Color(x[p]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;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,g=a.skinIndices.length;d<g;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,g,h,k,n,p;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],n=c.morphTargets[d].vertices,p=a.morphTargets[d].vertices,h=0,k=p.length;h<k;h+=3){var q=new THREE.Vector3;q.x=p[h]*b;q.y=p[h+1]*b;q.z=p[h+2]*b;n.push(q)}}if(void 0!==a.morphColors)for(d=
|
|
|
0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,n=a.morphColors[d].colors,b=0,h=n.length;b<h;b+=3)p=new THREE.Color(16755200),p.setRGB(n[b],n[b+1],n[b+2]),k.push(p)})(d);c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials||0===a.materials.length)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};
|
|
@@ -341,11 +341,11 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometr
|
|
|
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.log("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,f=new THREE.Vector3;return function(g,h){var k=this.geometry;null===k.boundingSphere&&k.computeBoundingSphere();c.copy(k.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==g.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(g.ray).applyMatrix4(a),null===k.boundingBox||!1!==b.isIntersectionBox(k.boundingBox)))if(k instanceof THREE.BufferGeometry){var n=
|
|
|
-this.material;if(void 0!==n){var p=k.attributes,q,m,t=g.precision;if(void 0!==p.index){var s=p.index.array,r=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:s.length,index:0}]);for(var w=0,x=u.length;w<x;++w)for(var p=u[w].start,L=u[w].index,k=p,v=p+u[w].count;k<v;k+=3){p=L+s[k];q=L+s[k+1];m=L+s[k+2];d.fromArray(r,3*p);e.fromArray(r,3*q);f.fromArray(r,3*m);var y=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide);if(null!==y){y.applyMatrix4(this.matrixWorld);
|
|
|
-var z=g.ray.origin.distanceTo(y);z<t||z<g.near||z>g.far||h.push({distance:z,point:y,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(r=p.position.array,s=k=0,v=r.length;k<v;k+=3,s+=9)p=k,q=k+1,m=k+2,d.fromArray(r,s),e.fromArray(r,s+3),f.fromArray(r,s+6),y=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide),null!==y&&(y.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(y),z<t||z<g.near||z>
|
|
|
-g.far||h.push({distance:z,point:y,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,r=!0===s?this.material.materials:null,t=g.precision,u=k.vertices,w=0,x=k.faces.length;w<x;w++)if(L=k.faces[w],n=!0===s?r[L.materialIndex]:this.material,void 0!==n){p=u[L.a];q=u[L.b];m=u[L.c];if(!0===n.morphTargets){y=k.morphTargets;z=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0,
|
|
|
-0,0);for(var v=0,C=y.length;v<C;v++){var G=z[v];if(0!==G){var E=y[v].vertices;d.x+=(E[L.a].x-p.x)*G;d.y+=(E[L.a].y-p.y)*G;d.z+=(E[L.a].z-p.z)*G;e.x+=(E[L.b].x-q.x)*G;e.y+=(E[L.b].y-q.y)*G;e.z+=(E[L.b].z-q.z)*G;f.x+=(E[L.c].x-m.x)*G;f.y+=(E[L.c].y-m.y)*G;f.z+=(E[L.c].z-m.z)*G}}d.add(p);e.add(q);f.add(m);p=d;q=e;m=f}y=n.side===THREE.BackSide?b.intersectTriangle(m,q,p,!0):b.intersectTriangle(p,q,m,n.side!==THREE.DoubleSide);null!==y&&(y.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(y),z<t||
|
|
|
-z<g.near||z>g.far||h.push({distance:z,point:y,face:L,faceIndex:w,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;
|
|
|
+this.material;if(void 0!==n){var p=k.attributes,q,m,t=g.precision;if(void 0!==p.index){var s=p.index.array,r=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:s.length,index:0}]);for(var v=0,y=u.length;v<y;++v)for(var p=u[v].start,L=u[v].index,k=p,x=p+u[v].count;k<x;k+=3){p=L+s[k];q=L+s[k+1];m=L+s[k+2];d.fromArray(r,3*p);e.fromArray(r,3*q);f.fromArray(r,3*m);var E=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide);if(null!==E){E.applyMatrix4(this.matrixWorld);
|
|
|
+var z=g.ray.origin.distanceTo(E);z<t||z<g.near||z>g.far||h.push({distance:z,point:E,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(r=p.position.array,s=k=0,x=r.length;k<x;k+=3,s+=9)p=k,q=k+1,m=k+2,d.fromArray(r,s),e.fromArray(r,s+3),f.fromArray(r,s+6),E=n.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,n.side!==THREE.DoubleSide),null!==E&&(E.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(E),z<t||z<g.near||z>
|
|
|
+g.far||h.push({distance:z,point:E,face:new THREE.Face3(p,q,m,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,r=!0===s?this.material.materials:null,t=g.precision,u=k.vertices,v=0,y=k.faces.length;v<y;v++)if(L=k.faces[v],n=!0===s?r[L.materialIndex]:this.material,void 0!==n){p=u[L.a];q=u[L.b];m=u[L.c];if(!0===n.morphTargets){E=k.morphTargets;z=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0,
|
|
|
+0,0);for(var x=0,F=E.length;x<F;x++){var D=z[x];if(0!==D){var w=E[x].vertices;d.x+=(w[L.a].x-p.x)*D;d.y+=(w[L.a].y-p.y)*D;d.z+=(w[L.a].z-p.z)*D;e.x+=(w[L.b].x-q.x)*D;e.y+=(w[L.b].y-q.y)*D;e.z+=(w[L.b].z-q.z)*D;f.x+=(w[L.c].x-m.x)*D;f.y+=(w[L.c].y-m.y)*D;f.z+=(w[L.c].z-m.z)*D}}d.add(p);e.add(q);f.add(m);p=d;q=e;m=f}E=n.side===THREE.BackSide?b.intersectTriangle(m,q,p,!0):b.intersectTriangle(p,q,m,n.side!==THREE.DoubleSide);null!==E&&(E.applyMatrix4(this.matrixWorld),z=g.ray.origin.distanceTo(E),z<t||
|
|
|
+z<g.near||z>g.far||h.push({distance:z,point:E,face:L,faceIndex:v,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;
|
|
|
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?(this.boneTextureHeight=this.boneTextureWidth=a=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),
|
|
|
this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)};
|
|
|
THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}};
|
|
@@ -441,132 +441,132 @@ THREE.WebGLRenderer=function(a){function b(a){var b=a.geometry;a=a.material;var
|
|
|
f),a.__skinWeightArray=new Float32Array(4*f));c=null!==aa.get("OES_element_index_uint")&&21845<g?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*g);a.__lineArray=new c(2*h);var k;if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,k=a.numMorphTargets;c<k;c++)a.__morphTargetsArrays.push(new Float32Array(3*f));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,k=a.numMorphNormals;c<k;c++)a.__morphNormalsArrays.push(new Float32Array(3*f));a.__webglFaceCount=3*g;a.__webglLineCount=
|
|
|
2*h;if(e.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var m in e.attributes){var g=e.attributes[m],h={},n;for(n in g)h[n]=g[n];if(!h.__webglInitialized||h.createUniqueBuffers)h.__webglInitialized=!0,c=1,"v2"===h.type?c=2:"v3"===h.type?c=3:"v4"===h.type?c=4:"c"===h.type&&(c=3),h.size=c,h.array=new Float32Array(f*c),h.buffer=l.createBuffer(),h.buffer.belongsToAttribute=m,g.needsUpdate=!0,h.__original=g;a.__webglCustomAttributesList.push(h)}}a.__inittedArrays=
|
|
|
!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a,b,c,d){c=c.attributes;var e=b.attributes;b=b.attributesKeys;for(var f=0,k=b.length;f<k;f++){var m=b[f],n=e[m];if(0<=n){var p=c[m];void 0!==p?(m=p.itemSize,l.bindBuffer(l.ARRAY_BUFFER,p.buffer),g(n),l.vertexAttribPointer(n,m,l.FLOAT,!1,0,d*m*4)):void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[m].length?l.vertexAttrib2fv(n,a.defaultAttributeValues[m]):
|
|
|
-3===a.defaultAttributeValues[m].length&&l.vertexAttrib3fv(n,a.defaultAttributeValues[m]))}}h()}function f(){for(var a=0,b=qb.length;a<b;a++)qb[a]=0}function g(a){qb[a]=1;0===Ta[a]&&(l.enableVertexAttribArray(a),Ta[a]=1)}function h(){for(var a=0,b=Ta.length;a<b;a++)Ta[a]!==qb[a]&&(l.disableVertexAttribArray(a),Ta[a]=0)}function k(a,b){return a.material.id!==b.material.id?b.material.id-a.material.id:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return b[0]-
|
|
|
-a[0]}function q(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group)){void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",ic));var c=a.geometry;if(void 0!==c&&void 0===c.__webglInit&&(c.__webglInit=!0,c.addEventListener("dispose",jc),!(c instanceof THREE.BufferGeometry)))if(a instanceof THREE.Mesh)r(a,c);else if(a instanceof THREE.Line){if(void 0===c.__webglVertexBuffer){c.__webglVertexBuffer=
|
|
|
-l.createBuffer();c.__webglColorBuffer=l.createBuffer();c.__webglLineDistanceBuffer=l.createBuffer();A.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer=l.createBuffer(),c.__webglColorBuffer=
|
|
|
-l.createBuffer(),A.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*d),c.__colorArray=new Float32Array(3*d),c.__sortArray=[],c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)u(za,c,a);else{if(c instanceof THREE.Geometry)for(var c=gb[c.id],d=0,e=c.length;d<e;d++)u(za,c[d],a)}else a instanceof THREE.Line||a instanceof THREE.PointCloud?
|
|
|
-u(za,c,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&Ha.push({id:null,object:a,opaque:null,transparent:null,z:0});if(a instanceof THREE.Light)oa.push(a);else if(a instanceof THREE.Sprite)hb.push(a);else if(a instanceof THREE.LensFlare)ib.push(a);else if((c=za[a.id])&&(!1===a.frustumCulled||!0===nb.intersectsObject(a)))for(d=0,e=c.length;d<e;d++){var f=c[d],g=f,h=g.object,k=g.buffer,m=h.geometry,h=h.material;h instanceof THREE.MeshFaceMaterial?(h=h.materials[m instanceof
|
|
|
-THREE.BufferGeometry?0:k.materialIndex],g.material=h,h.transparent?Ua.push(g):wa.push(g)):h&&(g.material=h,h.transparent?Ua.push(g):wa.push(g));f.render=!0;!0===A.sortObjects&&(null!==a.renderDepth?f.z=a.renderDepth:(Aa.setFromMatrixPosition(a.matrixWorld),Aa.applyProjection(Bb),f.z=Aa.z))}}d=0;for(e=a.children.length;d<e;d++)q(a.children[d])}}function m(a,b,c,d,e,f){for(var g,h=a.length-1;-1!==h;h--){g=a[h];var k=g.object,l=g.buffer;C(k,b);if(f)g=f;else{g=g.material;if(!g)continue;e&&A.setBlending(g.blending,
|
|
|
-g.blendEquation,g.blendSrc,g.blendDst);A.setDepthTest(g.depthTest);A.setDepthWrite(g.depthWrite);I(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}A.setMaterialFaces(g);l instanceof THREE.BufferGeometry?A.renderBufferDirect(b,c,d,g,l,k):A.renderBuffer(b,c,d,g,l,k)}}function t(a,b,c,d,e,f,g){for(var h,k=0,l=a.length;k<l;k++){h=a[k];var m=h.object;if(m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&A.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);A.setDepthTest(h.depthTest);
|
|
|
-A.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}A.renderImmediateObject(c,d,e,h,m)}}}function s(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function r(a,b){var d=a.material,e=!1;if(void 0===gb[b.id]||!0===b.groupsNeedUpdate){delete za[a.id];for(var f=gb,g=b.id,d=d instanceof THREE.MeshFaceMaterial,h=aa.get("OES_element_index_uint")?4294967296:65535,k,e={},m=b.morphTargets.length,n=b.morphNormals.length,
|
|
|
-p,q={},s=[],t=0,r=b.faces.length;t<r;t++){k=b.faces[t];var w=d?k.materialIndex:0;w in e||(e[w]={hash:w,counter:0});k=e[w].hash+"_"+e[w].counter;k in q||(p={id:kc++,faces3:[],materialIndex:w,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,s.push(p));q[k].vertices+3>h&&(e[w].counter+=1,k=e[w].hash+"_"+e[w].counter,k in q||(p={id:kc++,faces3:[],materialIndex:w,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,s.push(p)));q[k].faces3.push(t);q[k].vertices+=3}f[g]=s;b.groupsNeedUpdate=!1}f=
|
|
|
-gb[b.id];g=0;for(d=f.length;g<d;g++){h=f[g];if(void 0===h.__webglVertexBuffer){e=h;e.__webglVertexBuffer=l.createBuffer();e.__webglNormalBuffer=l.createBuffer();e.__webglTangentBuffer=l.createBuffer();e.__webglColorBuffer=l.createBuffer();e.__webglUVBuffer=l.createBuffer();e.__webglUV2Buffer=l.createBuffer();e.__webglSkinIndicesBuffer=l.createBuffer();e.__webglSkinWeightsBuffer=l.createBuffer();e.__webglFaceBuffer=l.createBuffer();e.__webglLineBuffer=l.createBuffer();n=m=void 0;if(e.numMorphTargets)for(e.__webglMorphTargetsBuffers=
|
|
|
-[],m=0,n=e.numMorphTargets;m<n;m++)e.__webglMorphTargetsBuffers.push(l.createBuffer());if(e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],m=0,n=e.numMorphNormals;m<n;m++)e.__webglMorphNormalsBuffers.push(l.createBuffer());A.info.memory.geometries++;c(h,a);b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&u(za,h,a)}a.__webglActive=!0}function u(a,
|
|
|
-b,c){var d=c.id;a[d]=a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function w(a){var b=a.geometry,e,f;if(b instanceof THREE.BufferGeometry)for(var g=b.attributes,h=b.attributesKeys,k=0,m=h.length;k<m;k++){var n=h[k],p=g[n];void 0===p.buffer&&(p.buffer=l.createBuffer(),p.needsUpdate=!0);if(!0===p.needsUpdate){var q="index"===n?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(q,p.buffer);l.bufferData(q,p.array,l.STATIC_DRAW);p.needsUpdate=!1}}else if(a instanceof THREE.Mesh){!0===
|
|
|
-b.groupsNeedUpdate&&r(a,b);for(var s=gb[b.id],t=0,w=s.length;t<w;t++){var u=s[t];f=d(a,u);!0===b.groupsNeedUpdate&&c(u,a);e=f.attributes&&x(f);if(b.verticesNeedUpdate||b.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||e){var v=u,z=a,C=l.DYNAMIC_DRAW,G=!b.dynamic,D=f;if(v.__inittedArrays){var E=D&&void 0!==D.shading&&D.shading===THREE.SmoothShading,y=void 0,A=void 0,I=void 0,F=void 0,M=void 0,J=void 0,O=void 0,V=void 0,R=
|
|
|
-void 0,U=void 0,Q=void 0,W=void 0,K=void 0,N=void 0,oa=void 0,za=void 0,fb=void 0,Ha=void 0,Ua=void 0,aa=void 0,ba=void 0,wa=void 0,ma=void 0,ga=void 0,P=void 0,hb=void 0,fa=void 0,ib=void 0,ca=void 0,na=void 0,pa=void 0,qa=void 0,xa=void 0,Aa=void 0,Da=void 0,Ia=void 0,Ya=void 0,Za=void 0,ka=void 0,ta=void 0,Va=0,Ma=0,Ga=0,Wa=0,rb=0,$a=0,Na=0,kb=0,ab=0,ha=0,la=0,H=0,Ba=void 0,Oa=v.__vertexArray,sb=v.__uvArray,lb=v.__uv2Array,bb=v.__normalArray,Ja=v.__tangentArray,cb=v.__colorArray,Ka=v.__skinIndexArray,
|
|
|
-Ea=v.__skinWeightArray,wb=v.__morphTargetsArrays,xb=v.__morphNormalsArrays,db=v.__webglCustomAttributesList,B=void 0,ya=v.__faceArray,Pa=v.__lineArray,Ca=z.geometry,La=Ca.elementsNeedUpdate,yb=Ca.uvsNeedUpdate,eb=Ca.normalsNeedUpdate,Ta=Ca.tangentsNeedUpdate,ob=Ca.colorsNeedUpdate,Kb=Ca.morphTargetsNeedUpdate,Qa=Ca.vertices,X=v.faces3,ra=Ca.faces,Hb=Ca.faceVertexUvs[0],Fb=Ca.faceVertexUvs[1],Y=Ca.skinIndices,Ib=Ca.skinWeights,T=Ca.morphTargets,$=Ca.morphNormals;if(Ca.verticesNeedUpdate){y=0;for(A=
|
|
|
-X.length;y<A;y++)F=ra[X[y]],W=Qa[F.a],K=Qa[F.b],N=Qa[F.c],Oa[Ma]=W.x,Oa[Ma+1]=W.y,Oa[Ma+2]=W.z,Oa[Ma+3]=K.x,Oa[Ma+4]=K.y,Oa[Ma+5]=K.z,Oa[Ma+6]=N.x,Oa[Ma+7]=N.y,Oa[Ma+8]=N.z,Ma+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Oa,C)}if(Kb)for(Da=0,Ia=T.length;Da<Ia;Da++){y=la=0;for(A=X.length;y<A;y++)ka=X[y],F=ra[ka],W=T[Da].vertices[F.a],K=T[Da].vertices[F.b],N=T[Da].vertices[F.c],Ya=wb[Da],Ya[la]=W.x,Ya[la+1]=W.y,Ya[la+2]=W.z,Ya[la+3]=K.x,Ya[la+4]=K.y,Ya[la+5]=K.z,
|
|
|
-Ya[la+6]=N.x,Ya[la+7]=N.y,Ya[la+8]=N.z,D.morphNormals&&(E?(ta=$[Da].vertexNormals[ka],Ha=ta.a,Ua=ta.b,aa=ta.c):aa=Ua=Ha=$[Da].faceNormals[ka],Za=xb[Da],Za[la]=Ha.x,Za[la+1]=Ha.y,Za[la+2]=Ha.z,Za[la+3]=Ua.x,Za[la+4]=Ua.y,Za[la+5]=Ua.z,Za[la+6]=aa.x,Za[la+7]=aa.y,Za[la+8]=aa.z),la+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[Da]);l.bufferData(l.ARRAY_BUFFER,wb[Da],C);D.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[Da]),l.bufferData(l.ARRAY_BUFFER,xb[Da],C))}if(Ib.length){y=
|
|
|
-0;for(A=X.length;y<A;y++)F=ra[X[y]],ga=Ib[F.a],P=Ib[F.b],hb=Ib[F.c],Ea[ha]=ga.x,Ea[ha+1]=ga.y,Ea[ha+2]=ga.z,Ea[ha+3]=ga.w,Ea[ha+4]=P.x,Ea[ha+5]=P.y,Ea[ha+6]=P.z,Ea[ha+7]=P.w,Ea[ha+8]=hb.x,Ea[ha+9]=hb.y,Ea[ha+10]=hb.z,Ea[ha+11]=hb.w,fa=Y[F.a],ib=Y[F.b],ca=Y[F.c],Ka[ha]=fa.x,Ka[ha+1]=fa.y,Ka[ha+2]=fa.z,Ka[ha+3]=fa.w,Ka[ha+4]=ib.x,Ka[ha+5]=ib.y,Ka[ha+6]=ib.z,Ka[ha+7]=ib.w,Ka[ha+8]=ca.x,Ka[ha+9]=ca.y,Ka[ha+10]=ca.z,Ka[ha+11]=ca.w,ha+=12;0<ha&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,
|
|
|
-Ka,C),l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Ea,C))}if(ob){y=0;for(A=X.length;y<A;y++)F=ra[X[y]],O=F.vertexColors,V=F.color,3===O.length&&D.vertexColors===THREE.VertexColors?(ba=O[0],wa=O[1],ma=O[2]):ma=wa=ba=V,cb[ab]=ba.r,cb[ab+1]=ba.g,cb[ab+2]=ba.b,cb[ab+3]=wa.r,cb[ab+4]=wa.g,cb[ab+5]=wa.b,cb[ab+6]=ma.r,cb[ab+7]=ma.g,cb[ab+8]=ma.b,ab+=9;0<ab&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,cb,C))}if(Ta&&Ca.hasTangents){y=
|
|
|
-0;for(A=X.length;y<A;y++)F=ra[X[y]],R=F.vertexTangents,oa=R[0],za=R[1],fb=R[2],Ja[Na]=oa.x,Ja[Na+1]=oa.y,Ja[Na+2]=oa.z,Ja[Na+3]=oa.w,Ja[Na+4]=za.x,Ja[Na+5]=za.y,Ja[Na+6]=za.z,Ja[Na+7]=za.w,Ja[Na+8]=fb.x,Ja[Na+9]=fb.y,Ja[Na+10]=fb.z,Ja[Na+11]=fb.w,Na+=12;l.bindBuffer(l.ARRAY_BUFFER,v.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,Ja,C)}if(eb){y=0;for(A=X.length;y<A;y++)if(F=ra[X[y]],M=F.vertexNormals,J=F.normal,3===M.length&&E)for(na=0;3>na;na++)qa=M[na],bb[$a]=qa.x,bb[$a+1]=qa.y,bb[$a+2]=qa.z,
|
|
|
-$a+=3;else for(na=0;3>na;na++)bb[$a]=J.x,bb[$a+1]=J.y,bb[$a+2]=J.z,$a+=3;l.bindBuffer(l.ARRAY_BUFFER,v.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,bb,C)}if(yb&&Hb){y=0;for(A=X.length;y<A;y++)if(I=X[y],U=Hb[I],void 0!==U)for(na=0;3>na;na++)xa=U[na],sb[Ga]=xa.x,sb[Ga+1]=xa.y,Ga+=2;0<Ga&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,sb,C))}if(yb&&Fb){y=0;for(A=X.length;y<A;y++)if(I=X[y],Q=Fb[I],void 0!==Q)for(na=0;3>na;na++)Aa=Q[na],lb[Wa]=Aa.x,lb[Wa+1]=Aa.y,Wa+=2;
|
|
|
-0<Wa&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,lb,C))}if(La){y=0;for(A=X.length;y<A;y++)ya[rb]=Va,ya[rb+1]=Va+1,ya[rb+2]=Va+2,rb+=3,Pa[kb]=Va,Pa[kb+1]=Va+1,Pa[kb+2]=Va,Pa[kb+3]=Va+2,Pa[kb+4]=Va+1,Pa[kb+5]=Va+2,kb+=6,Va+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ya,C);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Pa,C)}if(db)for(na=0,pa=db.length;na<pa;na++)if(B=db[na],
|
|
|
-B.__original.needsUpdate){H=0;if(1===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(y=0,A=X.length;y<A;y++)F=ra[X[y]],B.array[H]=B.value[F.a],B.array[H+1]=B.value[F.b],B.array[H+2]=B.value[F.c],H+=3;else{if("faces"===B.boundTo)for(y=0,A=X.length;y<A;y++)Ba=B.value[X[y]],B.array[H]=Ba,B.array[H+1]=Ba,B.array[H+2]=Ba,H+=3}else if(2===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(y=0,A=X.length;y<A;y++)F=ra[X[y]],W=B.value[F.a],K=B.value[F.b],N=B.value[F.c],B.array[H]=W.x,B.array[H+
|
|
|
-1]=W.y,B.array[H+2]=K.x,B.array[H+3]=K.y,B.array[H+4]=N.x,B.array[H+5]=N.y,H+=6;else{if("faces"===B.boundTo)for(y=0,A=X.length;y<A;y++)N=K=W=Ba=B.value[X[y]],B.array[H]=W.x,B.array[H+1]=W.y,B.array[H+2]=K.x,B.array[H+3]=K.y,B.array[H+4]=N.x,B.array[H+5]=N.y,H+=6}else if(3===B.size){var S;S="c"===B.type?["r","g","b"]:["x","y","z"];if(void 0===B.boundTo||"vertices"===B.boundTo)for(y=0,A=X.length;y<A;y++)F=ra[X[y]],W=B.value[F.a],K=B.value[F.b],N=B.value[F.c],B.array[H]=W[S[0]],B.array[H+1]=W[S[1]],
|
|
|
-B.array[H+2]=W[S[2]],B.array[H+3]=K[S[0]],B.array[H+4]=K[S[1]],B.array[H+5]=K[S[2]],B.array[H+6]=N[S[0]],B.array[H+7]=N[S[1]],B.array[H+8]=N[S[2]],H+=9;else if("faces"===B.boundTo)for(y=0,A=X.length;y<A;y++)N=K=W=Ba=B.value[X[y]],B.array[H]=W[S[0]],B.array[H+1]=W[S[1]],B.array[H+2]=W[S[2]],B.array[H+3]=K[S[0]],B.array[H+4]=K[S[1]],B.array[H+5]=K[S[2]],B.array[H+6]=N[S[0]],B.array[H+7]=N[S[1]],B.array[H+8]=N[S[2]],H+=9;else if("faceVertices"===B.boundTo)for(y=0,A=X.length;y<A;y++)Ba=B.value[X[y]],
|
|
|
-W=Ba[0],K=Ba[1],N=Ba[2],B.array[H]=W[S[0]],B.array[H+1]=W[S[1]],B.array[H+2]=W[S[2]],B.array[H+3]=K[S[0]],B.array[H+4]=K[S[1]],B.array[H+5]=K[S[2]],B.array[H+6]=N[S[0]],B.array[H+7]=N[S[1]],B.array[H+8]=N[S[2]],H+=9}else if(4===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(y=0,A=X.length;y<A;y++)F=ra[X[y]],W=B.value[F.a],K=B.value[F.b],N=B.value[F.c],B.array[H]=W.x,B.array[H+1]=W.y,B.array[H+2]=W.z,B.array[H+3]=W.w,B.array[H+4]=K.x,B.array[H+5]=K.y,B.array[H+6]=K.z,B.array[H+7]=K.w,B.array[H+
|
|
|
-8]=N.x,B.array[H+9]=N.y,B.array[H+10]=N.z,B.array[H+11]=N.w,H+=12;else if("faces"===B.boundTo)for(y=0,A=X.length;y<A;y++)N=K=W=Ba=B.value[X[y]],B.array[H]=W.x,B.array[H+1]=W.y,B.array[H+2]=W.z,B.array[H+3]=W.w,B.array[H+4]=K.x,B.array[H+5]=K.y,B.array[H+6]=K.z,B.array[H+7]=K.w,B.array[H+8]=N.x,B.array[H+9]=N.y,B.array[H+10]=N.z,B.array[H+11]=N.w,H+=12;else if("faceVertices"===B.boundTo)for(y=0,A=X.length;y<A;y++)Ba=B.value[X[y]],W=Ba[0],K=Ba[1],N=Ba[2],B.array[H]=W.x,B.array[H+1]=W.y,B.array[H+2]=
|
|
|
-W.z,B.array[H+3]=W.w,B.array[H+4]=K.x,B.array[H+5]=K.y,B.array[H+6]=K.z,B.array[H+7]=K.w,B.array[H+8]=N.x,B.array[H+9]=N.y,B.array[H+10]=N.z,B.array[H+11]=N.w,H+=12;l.bindBuffer(l.ARRAY_BUFFER,B.buffer);l.bufferData(l.ARRAY_BUFFER,B.array,C)}G&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate=
|
|
|
-!1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;f.attributes&&L(f)}else if(a instanceof THREE.Line){f=d(a,b);e=f.attributes&&x(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||e){var Fa=l.DYNAMIC_DRAW,ja,Cb,Db,Eb,Z,sa,Rb=b.vertices,Sb=b.colors,pb=b.lineDistances,Tb=Rb.length,zb=Sb.length,qb=pb.length,tb=b.__vertexArray,Lb=b.__colorArray,Jb=b.__lineDistanceArray,Pb=b.colorsNeedUpdate,
|
|
|
-Gb=b.lineDistancesNeedUpdate,mb=b.__webglCustomAttributesList,Xa,vb,ua,Mb,Ra,da;if(b.verticesNeedUpdate){for(ja=0;ja<Tb;ja++)Eb=Rb[ja],Z=3*ja,tb[Z]=Eb.x,tb[Z+1]=Eb.y,tb[Z+2]=Eb.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,tb,Fa)}if(Pb){for(Cb=0;Cb<zb;Cb++)sa=Sb[Cb],Z=3*Cb,Lb[Z]=sa.r,Lb[Z+1]=sa.g,Lb[Z+2]=sa.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,Lb,Fa)}if(Gb){for(Db=0;Db<qb;Db++)Jb[Db]=pb[Db];l.bindBuffer(l.ARRAY_BUFFER,b.__webglLineDistanceBuffer);
|
|
|
-l.bufferData(l.ARRAY_BUFFER,Jb,Fa)}if(mb)for(Xa=0,vb=mb.length;Xa<vb;Xa++)if(da=mb[Xa],da.needsUpdate&&(void 0===da.boundTo||"vertices"===da.boundTo)){Z=0;Mb=da.value.length;if(1===da.size)for(ua=0;ua<Mb;ua++)da.array[ua]=da.value[ua];else if(2===da.size)for(ua=0;ua<Mb;ua++)Ra=da.value[ua],da.array[Z]=Ra.x,da.array[Z+1]=Ra.y,Z+=2;else if(3===da.size)if("c"===da.type)for(ua=0;ua<Mb;ua++)Ra=da.value[ua],da.array[Z]=Ra.r,da.array[Z+1]=Ra.g,da.array[Z+2]=Ra.b,Z+=3;else for(ua=0;ua<Mb;ua++)Ra=da.value[ua],
|
|
|
-da.array[Z]=Ra.x,da.array[Z+1]=Ra.y,da.array[Z+2]=Ra.z,Z+=3;else if(4===da.size)for(ua=0;ua<Mb;ua++)Ra=da.value[ua],da.array[Z]=Ra.x,da.array[Z+1]=Ra.y,da.array[Z+2]=Ra.z,da.array[Z+3]=Ra.w,Z+=4;l.bindBuffer(l.ARRAY_BUFFER,da.buffer);l.bufferData(l.ARRAY_BUFFER,da.array,Fa);da.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;f.attributes&&L(f)}else if(a instanceof THREE.PointCloud){f=d(a,b);e=f.attributes&&x(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||
|
|
|
-e){var nb=l.DYNAMIC_DRAW,Ub,Vb,$b,ia,ac,Bb=b.vertices,Wb=Bb.length,Ob=b.colors,Xb=Ob.length,bc=b.__vertexArray,cc=b.__colorArray,Yb=b.colorsNeedUpdate,Ab=b.__webglCustomAttributesList,dc,ub,va,Nb,Sa,ea;if(b.verticesNeedUpdate){for(Ub=0;Ub<Wb;Ub++)$b=Bb[Ub],ia=3*Ub,bc[ia]=$b.x,bc[ia+1]=$b.y,bc[ia+2]=$b.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,bc,nb)}if(Yb){for(Vb=0;Vb<Xb;Vb++)ac=Ob[Vb],ia=3*Vb,cc[ia]=ac.r,cc[ia+1]=ac.g,cc[ia+2]=ac.b;l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
-b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,cc,nb)}if(Ab)for(dc=0,ub=Ab.length;dc<ub;dc++){ea=Ab[dc];if(ea.needsUpdate&&(void 0===ea.boundTo||"vertices"===ea.boundTo))if(Nb=ea.value.length,ia=0,1===ea.size)for(va=0;va<Nb;va++)ea.array[va]=ea.value[va];else if(2===ea.size)for(va=0;va<Nb;va++)Sa=ea.value[va],ea.array[ia]=Sa.x,ea.array[ia+1]=Sa.y,ia+=2;else if(3===ea.size)if("c"===ea.type)for(va=0;va<Nb;va++)Sa=ea.value[va],ea.array[ia]=Sa.r,ea.array[ia+1]=Sa.g,ea.array[ia+2]=Sa.b,ia+=3;else for(va=
|
|
|
-0;va<Nb;va++)Sa=ea.value[va],ea.array[ia]=Sa.x,ea.array[ia+1]=Sa.y,ea.array[ia+2]=Sa.z,ia+=3;else if(4===ea.size)for(va=0;va<Nb;va++)Sa=ea.value[va],ea.array[ia]=Sa.x,ea.array[ia+1]=Sa.y,ea.array[ia+2]=Sa.z,ea.array[ia+3]=Sa.w,ia+=4;l.bindBuffer(l.ARRAY_BUFFER,ea.buffer);l.bufferData(l.ARRAY_BUFFER,ea.array,nb);ea.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;f.attributes&&L(f)}}function x(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function L(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
|
|
|
-!1}function v(a,b,c,d,e){var f,g,h,k;Jb=0;if(d.needsUpdate){d.program&&lc(d);d.addEventListener("dispose",mc);var m;d instanceof THREE.MeshDepthMaterial?m="depth":d instanceof THREE.MeshNormalMaterial?m="normal":d instanceof THREE.MeshBasicMaterial?m="basic":d instanceof THREE.MeshLambertMaterial?m="lambert":d instanceof THREE.MeshPhongMaterial?m="phong":d instanceof THREE.LineBasicMaterial?m="basic":d instanceof THREE.LineDashedMaterial?m="dashed":d instanceof THREE.PointCloudMaterial&&(m="particle_basic");
|
|
|
-if(m){var n=THREE.ShaderLib[m];d.__webglShader={uniforms:THREE.UniformsUtils.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,s=0,t=0,r=0,v=b.length;r<v;r++){var w=b[r];w.onlyShadow||!1===w.visible||(w instanceof THREE.DirectionalLight&&p++,w instanceof THREE.PointLight&&q++,w instanceof THREE.SpotLight&&s++,w instanceof THREE.HemisphereLight&&t++)}f=
|
|
|
-p;g=q;h=s;k=t;for(var u,x=0,L=0,C=b.length;L<C;L++){var D=b[L];D.castShadow&&(D instanceof THREE.SpotLight&&x++,D instanceof THREE.DirectionalLight&&!D.shadowCascade&&x++)}u=x;var I;if(Wb&&e&&e.skeleton&&e.skeleton.useVertexTexture)I=1024;else{var W=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),K=Math.floor((W-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(K=Math.min(e.skeleton.bones.length,K),K<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+
|
|
|
-K+" (try OpenGL instead of ANGLE)"));I=K}var N={precision:R,supportsVertexTextures:Ob,map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:Ga,skinning:d.skinning,maxBones:I,useVertexTexture:Wb&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,
|
|
|
-maxMorphTargets:A.maxMorphTargets,maxMorphNormals:A.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:u,shadowMapEnabled:A.shadowMapEnabled&&e.receiveShadow&&0<u,shadowMapType:A.shadowMapType,shadowMapDebug:A.shadowMapDebug,shadowMapCascade:A.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},J=[];m?J.push(m):(J.push(d.fragmentShader),J.push(d.vertexShader));
|
|
|
-if(void 0!==d.defines)for(var O in d.defines)J.push(O),J.push(d.defines[O]);for(O in N)J.push(O),J.push(N[O]);for(var Q=J.join(),oa,za=0,fb=Wa.length;za<fb;za++){var Ha=Wa[za];if(Ha.code===Q){oa=Ha;oa.usedTimes++;break}}void 0===oa&&(oa=new THREE.WebGLProgram(A,Q,d,N),Wa.push(oa),A.info.memory.programs=Wa.length);d.program=oa;var Ua=oa.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var aa,ba="morphTarget",wa=0;wa<A.maxMorphTargets;wa++)aa=ba+wa,0<=Ua[aa]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=
|
|
|
-0,ba="morphNormal",wa=0;wa<A.maxMorphNormals;wa++)aa=ba+wa,0<=Ua[aa]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var hb in d.__webglShader.uniforms){var ib=d.program.uniforms[hb];ib&&d.uniformsList.push([d.__webglShader.uniforms[hb],ib])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets));var qa=!1,pa=!1,ta=!1,La=d.program,ga=La.uniforms,P=d.__webglShader.uniforms;La.id!==Xb&&(l.useProgram(La.program),Xb=La.id,
|
|
|
-ta=pa=qa=!0);d.id!==Kb&&(-1===Kb&&(ta=!0),Kb=d.id,pa=!0);if(qa||a!==Fb)l.uniformMatrix4fv(ga.projectionMatrix,!1,a.projectionMatrix.elements),Ga&&l.uniform1f(ga.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Fb&&(Fb=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==ga.cameraPosition&&(Aa.setFromMatrixPosition(a.matrixWorld),l.uniform3f(ga.cameraPosition,Aa.x,Aa.y,Aa.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof
|
|
|
-THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==ga.viewMatrix&&l.uniformMatrix4fv(ga.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==ga.bindMatrix&&l.uniformMatrix4fv(ga.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==ga.bindMatrixInverse&&l.uniformMatrix4fv(ga.bindMatrixInverse,!1,e.bindMatrixInverse.elements),Wb&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ga.boneTexture){var eb=z();l.uniform1i(ga.boneTexture,
|
|
|
-eb);A.setTexture(e.skeleton.boneTexture,eb)}null!==ga.boneTextureWidth&&l.uniform1i(ga.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ga.boneTextureHeight&&l.uniform1i(ga.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ga.boneGlobalMatrices&&l.uniformMatrix4fv(ga.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(pa){c&&d.fog&&(P.fogColor.value=c.color,c instanceof THREE.Fog?(P.fogNear.value=c.near,P.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
-(P.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Pb){var ta=!0,fa,jb,ca,na=0,Ta=0,Xa=0,xa,mb,Da,Ia,Ya,Za,ka=nc,gb=ka.directional.colors,Va=ka.directional.positions,Ma=ka.point.colors,nb=ka.point.positions,Ab=ka.point.distances,rb=ka.spot.colors,$a=ka.spot.positions,Na=ka.spot.distances,kb=ka.spot.directions,ab=ka.spot.anglesCos,ha=ka.spot.exponents,la=ka.hemi.skyColors,H=ka.hemi.groundColors,Ba=ka.hemi.positions,Oa=0,sb=
|
|
|
-0,lb=0,bb=0,Ja=0,cb=0,Ka=0,Ea=0,wb=0,xb=0,db=0,B=0;fa=0;for(jb=b.length;fa<jb;fa++)ca=b[fa],ca.onlyShadow||(xa=ca.color,Ia=ca.intensity,Za=ca.distance,ca instanceof THREE.AmbientLight?ca.visible&&(A.gammaInput?(na+=xa.r*xa.r,Ta+=xa.g*xa.g,Xa+=xa.b*xa.b):(na+=xa.r,Ta+=xa.g,Xa+=xa.b)):ca instanceof THREE.DirectionalLight?(Ja+=1,ca.visible&&(ma.setFromMatrixPosition(ca.matrixWorld),Aa.setFromMatrixPosition(ca.target.matrixWorld),ma.sub(Aa),ma.normalize(),wb=3*Oa,Va[wb]=ma.x,Va[wb+1]=ma.y,Va[wb+2]=ma.z,
|
|
|
-A.gammaInput?G(gb,wb,xa,Ia*Ia):E(gb,wb,xa,Ia),Oa+=1)):ca instanceof THREE.PointLight?(cb+=1,ca.visible&&(xb=3*sb,A.gammaInput?G(Ma,xb,xa,Ia*Ia):E(Ma,xb,xa,Ia),Aa.setFromMatrixPosition(ca.matrixWorld),nb[xb]=Aa.x,nb[xb+1]=Aa.y,nb[xb+2]=Aa.z,Ab[sb]=Za,sb+=1)):ca instanceof THREE.SpotLight?(Ka+=1,ca.visible&&(db=3*lb,A.gammaInput?G(rb,db,xa,Ia*Ia):E(rb,db,xa,Ia),ma.setFromMatrixPosition(ca.matrixWorld),$a[db]=ma.x,$a[db+1]=ma.y,$a[db+2]=ma.z,Na[lb]=Za,Aa.setFromMatrixPosition(ca.target.matrixWorld),
|
|
|
-ma.sub(Aa),ma.normalize(),kb[db]=ma.x,kb[db+1]=ma.y,kb[db+2]=ma.z,ab[lb]=Math.cos(ca.angle),ha[lb]=ca.exponent,lb+=1)):ca instanceof THREE.HemisphereLight&&(Ea+=1,ca.visible&&(ma.setFromMatrixPosition(ca.matrixWorld),ma.normalize(),B=3*bb,Ba[B]=ma.x,Ba[B+1]=ma.y,Ba[B+2]=ma.z,mb=ca.color,Da=ca.groundColor,A.gammaInput?(Ya=Ia*Ia,G(la,B,mb,Ya),G(H,B,Da,Ya)):(E(la,B,mb,Ia),E(H,B,Da,Ia)),bb+=1)));fa=3*Oa;for(jb=Math.max(gb.length,3*Ja);fa<jb;fa++)gb[fa]=0;fa=3*sb;for(jb=Math.max(Ma.length,3*cb);fa<jb;fa++)Ma[fa]=
|
|
|
-0;fa=3*lb;for(jb=Math.max(rb.length,3*Ka);fa<jb;fa++)rb[fa]=0;fa=3*bb;for(jb=Math.max(la.length,3*Ea);fa<jb;fa++)la[fa]=0;fa=3*bb;for(jb=Math.max(H.length,3*Ea);fa<jb;fa++)H[fa]=0;ka.directional.length=Oa;ka.point.length=sb;ka.spot.length=lb;ka.hemi.length=bb;ka.ambient[0]=na;ka.ambient[1]=Ta;ka.ambient[2]=Xa;Pb=!1}if(ta){var ya=nc;P.ambientLightColor.value=ya.ambient;P.directionalLightColor.value=ya.directional.colors;P.directionalLightDirection.value=ya.directional.positions;P.pointLightColor.value=
|
|
|
-ya.point.colors;P.pointLightPosition.value=ya.point.positions;P.pointLightDistance.value=ya.point.distances;P.spotLightColor.value=ya.spot.colors;P.spotLightPosition.value=ya.spot.positions;P.spotLightDistance.value=ya.spot.distances;P.spotLightDirection.value=ya.spot.directions;P.spotLightAngleCos.value=ya.spot.anglesCos;P.spotLightExponent.value=ya.spot.exponents;P.hemisphereLightSkyColor.value=ya.hemi.skyColors;P.hemisphereLightGroundColor.value=ya.hemi.groundColors;P.hemisphereLightDirection.value=
|
|
|
-ya.hemi.positions;y(P,!0)}else y(P,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){P.opacity.value=d.opacity;A.gammaInput?P.diffuse.value.copyGammaToLinear(d.color):P.diffuse.value=d.color;P.map.value=d.map;P.lightMap.value=d.lightMap;P.specularMap.value=d.specularMap;P.alphaMap.value=d.alphaMap;d.bumpMap&&(P.bumpMap.value=d.bumpMap,P.bumpScale.value=d.bumpScale);d.normalMap&&(P.normalMap.value=d.normalMap,P.normalScale.value.copy(d.normalScale));
|
|
|
-var Pa;d.map?Pa=d.map:d.specularMap?Pa=d.specularMap:d.normalMap?Pa=d.normalMap:d.bumpMap?Pa=d.bumpMap:d.alphaMap&&(Pa=d.alphaMap);if(void 0!==Pa){var Ca=Pa.offset,vb=Pa.repeat;P.offsetRepeat.value.set(Ca.x,Ca.y,vb.x,vb.y)}P.envMap.value=d.envMap;P.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;P.reflectivity.value=d.reflectivity;P.refractionRatio.value=d.refractionRatio;P.combine.value=d.combine;P.useRefract.value=d.envMap&&(d.envMap.mapping===THREE.CubeRefractionMapping||
|
|
|
-d.envMap.mapping===THREE.EquirectangularRefractionMapping)}d instanceof THREE.LineBasicMaterial?(P.diffuse.value=d.color,P.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(P.diffuse.value=d.color,P.opacity.value=d.opacity,P.dashSize.value=d.dashSize,P.totalSize.value=d.dashSize+d.gapSize,P.scale.value=d.scale):d instanceof THREE.PointCloudMaterial?(P.psColor.value=d.color,P.opacity.value=d.opacity,P.size.value=d.size,P.scale.value=F.height/2,P.map.value=d.map):d instanceof THREE.MeshPhongMaterial?
|
|
|
-(P.shininess.value=d.shininess,A.gammaInput?(P.ambient.value.copyGammaToLinear(d.ambient),P.emissive.value.copyGammaToLinear(d.emissive),P.specular.value.copyGammaToLinear(d.specular)):(P.ambient.value=d.ambient,P.emissive.value=d.emissive,P.specular.value=d.specular),d.wrapAround&&P.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(A.gammaInput?(P.ambient.value.copyGammaToLinear(d.ambient),P.emissive.value.copyGammaToLinear(d.emissive)):(P.ambient.value=d.ambient,P.emissive.value=
|
|
|
-d.emissive),d.wrapAround&&P.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(P.mNear.value=a.near,P.mFar.value=a.far,P.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(P.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&P.shadowMatrix)for(var yb=0,qb=0,Bb=b.length;qb<Bb;qb++){var ob=b[qb];ob.castShadow&&(ob instanceof THREE.SpotLight||ob instanceof THREE.DirectionalLight&&!ob.shadowCascade)&&(P.shadowMap.value[yb]=ob.shadowMap,P.shadowMapSize.value[yb]=
|
|
|
-ob.shadowMapSize,P.shadowMatrix.value[yb]=ob.shadowMatrix,P.shadowDarkness.value[yb]=ob.shadowDarkness,P.shadowBias.value[yb]=ob.shadowBias,yb++)}for(var ub=d.uniformsList,Qa,X,ra,Hb=0,Gb=ub.length;Hb<Gb;Hb++){var Y=ub[Hb][0];if(!1!==Y.needsUpdate){var Ib=Y.type,T=Y.value,$=ub[Hb][1];switch(Ib){case "1i":l.uniform1i($,T);break;case "1f":l.uniform1f($,T);break;case "2f":l.uniform2f($,T[0],T[1]);break;case "3f":l.uniform3f($,T[0],T[1],T[2]);break;case "4f":l.uniform4f($,T[0],T[1],T[2],T[3]);break;case "1iv":l.uniform1iv($,
|
|
|
-T);break;case "3iv":l.uniform3iv($,T);break;case "1fv":l.uniform1fv($,T);break;case "2fv":l.uniform2fv($,T);break;case "3fv":l.uniform3fv($,T);break;case "4fv":l.uniform4fv($,T);break;case "Matrix3fv":l.uniformMatrix3fv($,!1,T);break;case "Matrix4fv":l.uniformMatrix4fv($,!1,T);break;case "i":l.uniform1i($,T);break;case "f":l.uniform1f($,T);break;case "v2":l.uniform2f($,T.x,T.y);break;case "v3":l.uniform3f($,T.x,T.y,T.z);break;case "v4":l.uniform4f($,T.x,T.y,T.z,T.w);break;case "c":l.uniform3f($,T.r,
|
|
|
-T.g,T.b);break;case "iv1":l.uniform1iv($,T);break;case "iv":l.uniform3iv($,T);break;case "fv1":l.uniform1fv($,T);break;case "fv":l.uniform3fv($,T);break;case "v2v":void 0===Y._array&&(Y._array=new Float32Array(2*T.length));for(var S=0,Fa=T.length;S<Fa;S++)ra=2*S,Y._array[ra]=T[S].x,Y._array[ra+1]=T[S].y;l.uniform2fv($,Y._array);break;case "v3v":void 0===Y._array&&(Y._array=new Float32Array(3*T.length));S=0;for(Fa=T.length;S<Fa;S++)ra=3*S,Y._array[ra]=T[S].x,Y._array[ra+1]=T[S].y,Y._array[ra+2]=T[S].z;
|
|
|
-l.uniform3fv($,Y._array);break;case "v4v":void 0===Y._array&&(Y._array=new Float32Array(4*T.length));S=0;for(Fa=T.length;S<Fa;S++)ra=4*S,Y._array[ra]=T[S].x,Y._array[ra+1]=T[S].y,Y._array[ra+2]=T[S].z,Y._array[ra+3]=T[S].w;l.uniform4fv($,Y._array);break;case "m3":l.uniformMatrix3fv($,!1,T.elements);break;case "m3v":void 0===Y._array&&(Y._array=new Float32Array(9*T.length));S=0;for(Fa=T.length;S<Fa;S++)T[S].flattenToArrayOffset(Y._array,9*S);l.uniformMatrix3fv($,!1,Y._array);break;case "m4":l.uniformMatrix4fv($,
|
|
|
-!1,T.elements);break;case "m4v":void 0===Y._array&&(Y._array=new Float32Array(16*T.length));S=0;for(Fa=T.length;S<Fa;S++)T[S].flattenToArrayOffset(Y._array,16*S);l.uniformMatrix4fv($,!1,Y._array);break;case "t":Qa=T;X=z();l.uniform1i($,X);if(!Qa)continue;if(Qa instanceof THREE.CubeTexture||Qa.image instanceof Array&&6===Qa.image.length){var ja=Qa,Cb=X;if(6===ja.image.length)if(ja.needsUpdate){ja.image.__webglTextureCube||(ja.addEventListener("dispose",Yb),ja.image.__webglTextureCube=l.createTexture(),
|
|
|
-A.info.memory.textures++);l.activeTexture(l.TEXTURE0+Cb);l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,ja.flipY);for(var Db=ja instanceof THREE.CompressedTexture,Eb=ja.image[0]instanceof THREE.DataTexture,Z=[],sa=0;6>sa;sa++)Z[sa]=!A.autoScaleCubemaps||Db||Eb?Eb?ja.image[sa].image:ja.image[sa]:M(ja.image[sa],Dc);var Rb=Z[0],Sb=THREE.Math.isPowerOfTwo(Rb.width)&&THREE.Math.isPowerOfTwo(Rb.height),pb=V(ja.format),Tb=V(ja.type);U(l.TEXTURE_CUBE_MAP,
|
|
|
-ja,Sb);for(sa=0;6>sa;sa++)if(Db)for(var zb,Qb=Z[sa].mipmaps,tb=0,Lb=Qb.length;tb<Lb;tb++)zb=Qb[tb],ja.format!==THREE.RGBAFormat&&ja.format!==THREE.RGBFormat?-1<oc().indexOf(pb)?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+sa,tb,pb,zb.width,zb.height,0,zb.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+sa,tb,pb,zb.width,zb.height,0,pb,Tb,zb.data);else Eb?l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+sa,0,pb,Z[sa].width,Z[sa].height,
|
|
|
-0,pb,Tb,Z[sa].data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+sa,0,pb,pb,Tb,Z[sa]);ja.generateMipmaps&&Sb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);ja.needsUpdate=!1;if(ja.onUpdate)ja.onUpdate()}else l.activeTexture(l.TEXTURE0+Cb),l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube)}else if(Qa instanceof THREE.WebGLRenderTargetCube){var Zb=Qa;l.activeTexture(l.TEXTURE0+X);l.bindTexture(l.TEXTURE_CUBE_MAP,Zb.__webglTexture)}else A.setTexture(Qa,X);break;case "tv":void 0===Y._array&&(Y._array=
|
|
|
-[]);S=0;for(Fa=Y.value.length;S<Fa;S++)Y._array[S]=z();l.uniform1iv($,Y._array);S=0;for(Fa=Y.value.length;S<Fa;S++)Qa=Y.value[S],X=Y._array[S],Qa&&A.setTexture(Qa,X);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Ib)}}}}l.uniformMatrix4fv(ga.modelViewMatrix,!1,e._modelViewMatrix.elements);ga.normalMatrix&&l.uniformMatrix3fv(ga.normalMatrix,!1,e._normalMatrix.elements);null!==ga.modelMatrix&&l.uniformMatrix4fv(ga.modelMatrix,!1,e.matrixWorld.elements);return La}function y(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.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=
|
|
|
-b;a.hemisphereLightDirection.needsUpdate=b}function z(){var a=Jb;a>=pc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+pc);Jb+=1;return a}function C(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function G(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function E(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a!==qc&&(l.lineWidth(a),qc=a)}function I(a,
|
|
|
-b,c){rc!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),rc=a);!a||sc===b&&tc===c||(l.polygonOffset(b,c),sc=b,tc=c)}function U(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,V(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,V(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,V(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,V(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.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 is set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),l.texParameteri(a,l.TEXTURE_MAG_FILTER,O(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,O(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter is set to THREE.LinearFilter or THREE.NearestFilter. ( "+
|
|
|
-b.sourceFile+" )"));(c=aa.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,A.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function M(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.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function J(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,
|
|
|
-l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function K(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function O(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
|
|
|
-l.NEAREST:l.LINEAR}function V(a){var b;if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===
|
|
|
+3===a.defaultAttributeValues[m].length&&l.vertexAttrib3fv(n,a.defaultAttributeValues[m]))}}h()}function f(){for(var a=0,b=ib.length;a<b;a++)ib[a]=0}function g(a){ib[a]=1;0===Ra[a]&&(l.enableVertexAttribArray(a),Ra[a]=1)}function h(){for(var a=0,b=Ra.length;a<b;a++)Ra[a]!==ib[a]&&(l.disableVertexAttribArray(a),Ra[a]=0)}function k(a,b){return a.material.id!==b.material.id?b.material.id-a.material.id:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return b[0]-
|
|
|
+a[0]}function q(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group)){void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",hc));var c=a.geometry;if(void 0!==c&&void 0===c.__webglInit&&(c.__webglInit=!0,c.addEventListener("dispose",ic),!(c instanceof THREE.BufferGeometry)))if(a instanceof THREE.Mesh)r(a,c);else if(a instanceof THREE.Line){if(void 0===c.__webglVertexBuffer){c.__webglVertexBuffer=
|
|
|
+l.createBuffer();c.__webglColorBuffer=l.createBuffer();c.__webglLineDistanceBuffer=l.createBuffer();J.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer=l.createBuffer(),c.__webglColorBuffer=
|
|
|
+l.createBuffer(),J.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*d),c.__colorArray=new Float32Array(3*d),c.__sortArray=[],c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)u(Ca,c,a);else{if(c instanceof THREE.Geometry)for(var c=jb[c.id],d=0,e=c.length;d<e;d++)u(Ca,c[d],a)}else a instanceof THREE.Line||a instanceof THREE.PointCloud?
|
|
|
+u(Ca,c,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&Ia.push({id:null,object:a,opaque:null,transparent:null,z:0});if(a instanceof THREE.Light)oa.push(a);else if(a instanceof THREE.Sprite)eb.push(a);else if(a instanceof THREE.LensFlare)fb.push(a);else if((c=Ca[a.id])&&(!1===a.frustumCulled||!0===kb.intersectsObject(a)))for(d=0,e=c.length;d<e;d++){var f=c[d],g=f,h=g.object,k=g.buffer,m=h.geometry,h=h.material;h instanceof THREE.MeshFaceMaterial?(h=h.materials[m instanceof
|
|
|
+THREE.BufferGeometry?0:k.materialIndex],g.material=h,h.transparent?Sa.push(g):xa.push(g)):h&&(g.material=h,h.transparent?Sa.push(g):xa.push(g));f.render=!0;!0===J.sortObjects&&(null!==a.renderDepth?f.z=a.renderDepth:(Da.setFromMatrixPosition(a.matrixWorld),Da.applyProjection(ub),f.z=Da.z))}}d=0;for(e=a.children.length;d<e;d++)q(a.children[d])}}function m(a,b,c,d,e,f){for(var g,h=a.length-1;-1!==h;h--){g=a[h];var l=g.object,k=g.buffer;F(l,b);if(f)g=f;else{g=g.material;if(!g)continue;e&&J.setBlending(g.blending,
|
|
|
+g.blendEquation,g.blendSrc,g.blendDst);J.setDepthTest(g.depthTest);J.setDepthWrite(g.depthWrite);A(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}J.setMaterialFaces(g);k instanceof THREE.BufferGeometry?J.renderBufferDirect(b,c,d,g,k,l):J.renderBuffer(b,c,d,g,k,l)}}function t(a,b,c,d,e,f,g){for(var h,l=0,k=a.length;l<k;l++){h=a[l];var m=h.object;if(m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&J.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);J.setDepthTest(h.depthTest);
|
|
|
+J.setDepthWrite(h.depthWrite);A(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}J.renderImmediateObject(c,d,e,h,m)}}}function s(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function r(a,b){var d=a.material,e=!1;if(void 0===jb[b.id]||!0===b.groupsNeedUpdate){delete Ca[a.id];for(var f=jb,g=b.id,d=d instanceof THREE.MeshFaceMaterial,h=aa.get("OES_element_index_uint")?4294967296:65535,k,e={},m=b.morphTargets.length,n=b.morphNormals.length,
|
|
|
+p,q={},r=[],t=0,s=b.faces.length;t<s;t++){k=b.faces[t];var v=d?k.materialIndex:0;v in e||(e[v]={hash:v,counter:0});k=e[v].hash+"_"+e[v].counter;k in q||(p={id:jc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,r.push(p));q[k].vertices+3>h&&(e[v].counter+=1,k=e[v].hash+"_"+e[v].counter,k in q||(p={id:jc++,faces3:[],materialIndex:v,vertices:0,numMorphTargets:m,numMorphNormals:n},q[k]=p,r.push(p)));q[k].faces3.push(t);q[k].vertices+=3}f[g]=r;b.groupsNeedUpdate=!1}f=
|
|
|
+jb[b.id];g=0;for(d=f.length;g<d;g++){h=f[g];if(void 0===h.__webglVertexBuffer){e=h;e.__webglVertexBuffer=l.createBuffer();e.__webglNormalBuffer=l.createBuffer();e.__webglTangentBuffer=l.createBuffer();e.__webglColorBuffer=l.createBuffer();e.__webglUVBuffer=l.createBuffer();e.__webglUV2Buffer=l.createBuffer();e.__webglSkinIndicesBuffer=l.createBuffer();e.__webglSkinWeightsBuffer=l.createBuffer();e.__webglFaceBuffer=l.createBuffer();e.__webglLineBuffer=l.createBuffer();n=m=void 0;if(e.numMorphTargets)for(e.__webglMorphTargetsBuffers=
|
|
|
+[],m=0,n=e.numMorphTargets;m<n;m++)e.__webglMorphTargetsBuffers.push(l.createBuffer());if(e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],m=0,n=e.numMorphNormals;m<n;m++)e.__webglMorphNormalsBuffers.push(l.createBuffer());J.info.memory.geometries++;c(h,a);b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&u(Ca,h,a)}a.__webglActive=!0}function u(a,
|
|
|
+b,c){var d=c.id;a[d]=a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function v(a){var b=a.geometry,e,f;if(b instanceof THREE.BufferGeometry)for(var g=b.attributes,h=b.attributesKeys,k=0,m=h.length;k<m;k++){var n=h[k],p=g[n];void 0===p.buffer&&(p.buffer=l.createBuffer(),p.needsUpdate=!0);if(!0===p.needsUpdate){var q="index"===n?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER;l.bindBuffer(q,p.buffer);l.bufferData(q,p.array,l.STATIC_DRAW);p.needsUpdate=!1}}else if(a instanceof THREE.Mesh){!0===
|
|
|
+b.groupsNeedUpdate&&r(a,b);for(var t=jb[b.id],k=0,s=t.length;k<s;k++){var u=t[k];f=d(a,u);!0===b.groupsNeedUpdate&&c(u,a);e=f.attributes&&y(f);if(b.verticesNeedUpdate||b.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||e){var v=u,x=a,z=l.DYNAMIC_DRAW,F=!b.dynamic,D=f;if(v.__inittedArrays){var C=D&&void 0!==D.shading&&D.shading===THREE.SmoothShading,w=void 0,E=void 0,J=void 0,A=void 0,P=void 0,M=void 0,I=void 0,N=void 0,T=
|
|
|
+void 0,Q=void 0,U=void 0,G=void 0,V=void 0,K=void 0,X=void 0,oa=void 0,Ca=void 0,db=void 0,Ia=void 0,Sa=void 0,aa=void 0,ca=void 0,xa=void 0,la=void 0,ga=void 0,O=void 0,eb=void 0,fa=void 0,fb=void 0,Y=void 0,pa=void 0,qa=void 0,Da=void 0,ya=void 0,Fa=void 0,Ba=void 0,ma=void 0,Ya=void 0,La=void 0,ka=void 0,Ma=0,Ta=0,nb=0,Wa=0,wa=0,Ua=0,Ga=0,ob=0,Na=0,ha=0,ra=0,H=0,za=void 0,Za=v.__vertexArray,vb=v.__uvArray,pb=v.__uv2Array,Oa=v.__normalArray,Aa=v.__tangentArray,$a=v.__colorArray,Ja=v.__skinIndexArray,
|
|
|
+Ka=v.__skinWeightArray,ab=v.__morphTargetsArrays,wb=v.__morphNormalsArrays,qb=v.__webglCustomAttributesList,B=void 0,cb=v.__faceArray,sa=v.__lineArray,na=x.geometry,Ra=na.elementsNeedUpdate,Cb=na.uvsNeedUpdate,Ab=na.normalsNeedUpdate,Jb=na.tangentsNeedUpdate,ib=na.colorsNeedUpdate,lb=na.morphTargetsNeedUpdate,Db=na.vertices,W=v.faces3,Ha=na.faces,Va=na.faceVertexUvs[0],Eb=na.faceVertexUvs[1],Ob=na.skinIndices,$=na.skinWeights,Fb=na.morphTargets,R=na.morphNormals;if(na.verticesNeedUpdate){w=0;for(E=
|
|
|
+W.length;w<E;w++)A=Ha[W[w]],G=Db[A.a],V=Db[A.b],K=Db[A.c],Za[Ta]=G.x,Za[Ta+1]=G.y,Za[Ta+2]=G.z,Za[Ta+3]=V.x,Za[Ta+4]=V.y,Za[Ta+5]=V.z,Za[Ta+6]=K.x,Za[Ta+7]=K.y,Za[Ta+8]=K.z,Ta+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Za,z)}if(lb)for(Fa=0,Ba=Fb.length;Fa<Ba;Fa++){w=ra=0;for(E=W.length;w<E;w++)La=W[w],A=Ha[La],G=Fb[Fa].vertices[A.a],V=Fb[Fa].vertices[A.b],K=Fb[Fa].vertices[A.c],ma=ab[Fa],ma[ra]=G.x,ma[ra+1]=G.y,ma[ra+2]=G.z,ma[ra+3]=V.x,ma[ra+4]=V.y,ma[ra+5]=
|
|
|
+V.z,ma[ra+6]=K.x,ma[ra+7]=K.y,ma[ra+8]=K.z,D.morphNormals&&(C?(ka=R[Fa].vertexNormals[La],db=ka.a,Ia=ka.b,Sa=ka.c):Sa=Ia=db=R[Fa].faceNormals[La],Ya=wb[Fa],Ya[ra]=db.x,Ya[ra+1]=db.y,Ya[ra+2]=db.z,Ya[ra+3]=Ia.x,Ya[ra+4]=Ia.y,Ya[ra+5]=Ia.z,Ya[ra+6]=Sa.x,Ya[ra+7]=Sa.y,Ya[ra+8]=Sa.z),ra+=9;l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[Fa]);l.bufferData(l.ARRAY_BUFFER,ab[Fa],z);D.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[Fa]),l.bufferData(l.ARRAY_BUFFER,wb[Fa],
|
|
|
+z))}if($.length){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],la=$[A.a],ga=$[A.b],O=$[A.c],Ka[ha]=la.x,Ka[ha+1]=la.y,Ka[ha+2]=la.z,Ka[ha+3]=la.w,Ka[ha+4]=ga.x,Ka[ha+5]=ga.y,Ka[ha+6]=ga.z,Ka[ha+7]=ga.w,Ka[ha+8]=O.x,Ka[ha+9]=O.y,Ka[ha+10]=O.z,Ka[ha+11]=O.w,eb=Ob[A.a],fa=Ob[A.b],fb=Ob[A.c],Ja[ha]=eb.x,Ja[ha+1]=eb.y,Ja[ha+2]=eb.z,Ja[ha+3]=eb.w,Ja[ha+4]=fa.x,Ja[ha+5]=fa.y,Ja[ha+6]=fa.z,Ja[ha+7]=fa.w,Ja[ha+8]=fb.x,Ja[ha+9]=fb.y,Ja[ha+10]=fb.z,Ja[ha+11]=fb.w,ha+=12;0<ha&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinIndicesBuffer),
|
|
|
+l.bufferData(l.ARRAY_BUFFER,Ja,z),l.bindBuffer(l.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,Ka,z))}if(ib){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],I=A.vertexColors,N=A.color,3===I.length&&D.vertexColors===THREE.VertexColors?(aa=I[0],ca=I[1],xa=I[2]):xa=ca=aa=N,$a[Na]=aa.r,$a[Na+1]=aa.g,$a[Na+2]=aa.b,$a[Na+3]=ca.r,$a[Na+4]=ca.g,$a[Na+5]=ca.b,$a[Na+6]=xa.r,$a[Na+7]=xa.g,$a[Na+8]=xa.b,Na+=9;0<Na&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,$a,
|
|
|
+z))}if(Jb&&na.hasTangents){w=0;for(E=W.length;w<E;w++)A=Ha[W[w]],T=A.vertexTangents,X=T[0],oa=T[1],Ca=T[2],Aa[Ga]=X.x,Aa[Ga+1]=X.y,Aa[Ga+2]=X.z,Aa[Ga+3]=X.w,Aa[Ga+4]=oa.x,Aa[Ga+5]=oa.y,Aa[Ga+6]=oa.z,Aa[Ga+7]=oa.w,Aa[Ga+8]=Ca.x,Aa[Ga+9]=Ca.y,Aa[Ga+10]=Ca.z,Aa[Ga+11]=Ca.w,Ga+=12;l.bindBuffer(l.ARRAY_BUFFER,v.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,Aa,z)}if(Ab){w=0;for(E=W.length;w<E;w++)if(A=Ha[W[w]],P=A.vertexNormals,M=A.normal,3===P.length&&C)for(Y=0;3>Y;Y++)qa=P[Y],Oa[Ua]=qa.x,Oa[Ua+1]=
|
|
|
+qa.y,Oa[Ua+2]=qa.z,Ua+=3;else for(Y=0;3>Y;Y++)Oa[Ua]=M.x,Oa[Ua+1]=M.y,Oa[Ua+2]=M.z,Ua+=3;l.bindBuffer(l.ARRAY_BUFFER,v.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,Oa,z)}if(Cb&&Va){w=0;for(E=W.length;w<E;w++)if(J=W[w],Q=Va[J],void 0!==Q)for(Y=0;3>Y;Y++)Da=Q[Y],vb[nb]=Da.x,vb[nb+1]=Da.y,nb+=2;0<nb&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,vb,z))}if(Cb&&Eb){w=0;for(E=W.length;w<E;w++)if(J=W[w],U=Eb[J],void 0!==U)for(Y=0;3>Y;Y++)ya=U[Y],pb[Wa]=ya.x,pb[Wa+1]=ya.y,
|
|
|
+Wa+=2;0<Wa&&(l.bindBuffer(l.ARRAY_BUFFER,v.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,pb,z))}if(Ra){w=0;for(E=W.length;w<E;w++)cb[wa]=Ma,cb[wa+1]=Ma+1,cb[wa+2]=Ma+2,wa+=3,sa[ob]=Ma,sa[ob+1]=Ma+1,sa[ob+2]=Ma,sa[ob+3]=Ma+2,sa[ob+4]=Ma+1,sa[ob+5]=Ma+2,ob+=6,Ma+=3;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,cb,z);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,sa,z)}if(qb)for(Y=0,pa=qb.length;Y<pa;Y++)if(B=
|
|
|
+qb[Y],B.__original.needsUpdate){H=0;if(1===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],B.array[H]=B.value[A.a],B.array[H+1]=B.value[A.b],B.array[H+2]=B.value[A.c],H+=3;else{if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],B.array[H]=za,B.array[H+1]=za,B.array[H+2]=za,H+=3}else if(2===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],K=B.value[A.c],B.array[H]=G.x,
|
|
|
+B.array[H+1]=G.y,B.array[H+2]=V.x,B.array[H+3]=V.y,B.array[H+4]=K.x,B.array[H+5]=K.y,H+=6;else{if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)K=V=G=za=B.value[W[w]],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=V.x,B.array[H+3]=V.y,B.array[H+4]=K.x,B.array[H+5]=K.y,H+=6}else if(3===B.size){var S;S="c"===B.type?["r","g","b"]:["x","y","z"];if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],K=B.value[A.c],B.array[H]=G[S[0]],B.array[H+1]=
|
|
|
+G[S[1]],B.array[H+2]=G[S[2]],B.array[H+3]=V[S[0]],B.array[H+4]=V[S[1]],B.array[H+5]=V[S[2]],B.array[H+6]=K[S[0]],B.array[H+7]=K[S[1]],B.array[H+8]=K[S[2]],H+=9;else if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)K=V=G=za=B.value[W[w]],B.array[H]=G[S[0]],B.array[H+1]=G[S[1]],B.array[H+2]=G[S[2]],B.array[H+3]=V[S[0]],B.array[H+4]=V[S[1]],B.array[H+5]=V[S[2]],B.array[H+6]=K[S[0]],B.array[H+7]=K[S[1]],B.array[H+8]=K[S[2]],H+=9;else if("faceVertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],
|
|
|
+G=za[0],V=za[1],K=za[2],B.array[H]=G[S[0]],B.array[H+1]=G[S[1]],B.array[H+2]=G[S[2]],B.array[H+3]=V[S[0]],B.array[H+4]=V[S[1]],B.array[H+5]=V[S[2]],B.array[H+6]=K[S[0]],B.array[H+7]=K[S[1]],B.array[H+8]=K[S[2]],H+=9}else if(4===B.size)if(void 0===B.boundTo||"vertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)A=Ha[W[w]],G=B.value[A.a],V=B.value[A.b],K=B.value[A.c],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=G.z,B.array[H+3]=G.w,B.array[H+4]=V.x,B.array[H+5]=V.y,B.array[H+6]=V.z,B.array[H+7]=V.w,B.array[H+
|
|
|
+8]=K.x,B.array[H+9]=K.y,B.array[H+10]=K.z,B.array[H+11]=K.w,H+=12;else if("faces"===B.boundTo)for(w=0,E=W.length;w<E;w++)K=V=G=za=B.value[W[w]],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=G.z,B.array[H+3]=G.w,B.array[H+4]=V.x,B.array[H+5]=V.y,B.array[H+6]=V.z,B.array[H+7]=V.w,B.array[H+8]=K.x,B.array[H+9]=K.y,B.array[H+10]=K.z,B.array[H+11]=K.w,H+=12;else if("faceVertices"===B.boundTo)for(w=0,E=W.length;w<E;w++)za=B.value[W[w]],G=za[0],V=za[1],K=za[2],B.array[H]=G.x,B.array[H+1]=G.y,B.array[H+2]=
|
|
|
+G.z,B.array[H+3]=G.w,B.array[H+4]=V.x,B.array[H+5]=V.y,B.array[H+6]=V.z,B.array[H+7]=V.w,B.array[H+8]=K.x,B.array[H+9]=K.y,B.array[H+10]=K.z,B.array[H+11]=K.w,H+=12;l.bindBuffer(l.ARRAY_BUFFER,B.buffer);l.bufferData(l.ARRAY_BUFFER,B.array,z)}F&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate=
|
|
|
+!1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;f.attributes&&L(f)}else if(a instanceof THREE.Line){f=d(a,b);e=f.attributes&&y(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||e){var Z=l.DYNAMIC_DRAW,Ea,ja,Bb,Gb,ba,hb,ta=b.vertices,Pb=b.colors,Qb=b.lineDistances,rb=ta.length,Rb=Pb.length,xb=Qb.length,Hb=b.__vertexArray,sb=b.__colorArray,Ib=b.__lineDistanceArray,Nb=b.colorsNeedUpdate,
|
|
|
+tb=b.lineDistancesNeedUpdate,bb=b.__webglCustomAttributesList,Xa,zb,ua,Kb,Pa,da;if(b.verticesNeedUpdate){for(Ea=0;Ea<rb;Ea++)Gb=ta[Ea],ba=3*Ea,Hb[ba]=Gb.x,Hb[ba+1]=Gb.y,Hb[ba+2]=Gb.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Hb,Z)}if(Nb){for(ja=0;ja<Rb;ja++)hb=Pb[ja],ba=3*ja,sb[ba]=hb.r,sb[ba+1]=hb.g,sb[ba+2]=hb.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,sb,Z)}if(tb){for(Bb=0;Bb<xb;Bb++)Ib[Bb]=Qb[Bb];l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
+b.__webglLineDistanceBuffer);l.bufferData(l.ARRAY_BUFFER,Ib,Z)}if(bb)for(Xa=0,zb=bb.length;Xa<zb;Xa++)if(da=bb[Xa],da.needsUpdate&&(void 0===da.boundTo||"vertices"===da.boundTo)){ba=0;Kb=da.value.length;if(1===da.size)for(ua=0;ua<Kb;ua++)da.array[ua]=da.value[ua];else if(2===da.size)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,ba+=2;else if(3===da.size)if("c"===da.type)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.r,da.array[ba+1]=Pa.g,da.array[ba+2]=Pa.b,ba+=3;
|
|
|
+else for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,da.array[ba+2]=Pa.z,ba+=3;else if(4===da.size)for(ua=0;ua<Kb;ua++)Pa=da.value[ua],da.array[ba]=Pa.x,da.array[ba+1]=Pa.y,da.array[ba+2]=Pa.z,da.array[ba+3]=Pa.w,ba+=4;l.bindBuffer(l.ARRAY_BUFFER,da.buffer);l.bufferData(l.ARRAY_BUFFER,da.array,Z);da.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;f.attributes&&L(f)}else if(a instanceof THREE.PointCloud){f=d(a,b);e=f.attributes&&
|
|
|
+y(f);if(b.verticesNeedUpdate||b.colorsNeedUpdate||e){var kb=l.DYNAMIC_DRAW,Sb,Tb,$b,ia,ac,ub=b.vertices,Ub=ub.length,Mb=b.colors,Vb=Mb.length,bc=b.__vertexArray,cc=b.__colorArray,Wb=b.colorsNeedUpdate,mb=b.__webglCustomAttributesList,dc,yb,va,Lb,Qa,ea;if(b.verticesNeedUpdate){for(Sb=0;Sb<Ub;Sb++)$b=ub[Sb],ia=3*Sb,bc[ia]=$b.x,bc[ia+1]=$b.y,bc[ia+2]=$b.z;l.bindBuffer(l.ARRAY_BUFFER,b.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,bc,kb)}if(Wb){for(Tb=0;Tb<Vb;Tb++)ac=Mb[Tb],ia=3*Tb,cc[ia]=ac.r,cc[ia+
|
|
|
+1]=ac.g,cc[ia+2]=ac.b;l.bindBuffer(l.ARRAY_BUFFER,b.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,cc,kb)}if(mb)for(dc=0,yb=mb.length;dc<yb;dc++){ea=mb[dc];if(ea.needsUpdate&&(void 0===ea.boundTo||"vertices"===ea.boundTo))if(Lb=ea.value.length,ia=0,1===ea.size)for(va=0;va<Lb;va++)ea.array[va]=ea.value[va];else if(2===ea.size)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ia+=2;else if(3===ea.size)if("c"===ea.type)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.r,ea.array[ia+
|
|
|
+1]=Qa.g,ea.array[ia+2]=Qa.b,ia+=3;else for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ea.array[ia+2]=Qa.z,ia+=3;else if(4===ea.size)for(va=0;va<Lb;va++)Qa=ea.value[va],ea.array[ia]=Qa.x,ea.array[ia+1]=Qa.y,ea.array[ia+2]=Qa.z,ea.array[ia+3]=Qa.w,ia+=4;l.bindBuffer(l.ARRAY_BUFFER,ea.buffer);l.bufferData(l.ARRAY_BUFFER,ea.array,kb);ea.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;f.attributes&&L(f)}}function y(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
|
+return!1}function L(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;Ib=0;if(d.needsUpdate){d.program&&kc(d);d.addEventListener("dispose",lc);var m;d instanceof THREE.MeshDepthMaterial?m="depth":d instanceof THREE.MeshNormalMaterial?m="normal":d instanceof THREE.MeshBasicMaterial?m="basic":d instanceof THREE.MeshLambertMaterial?m="lambert":d instanceof THREE.MeshPhongMaterial?m="phong":d instanceof THREE.LineBasicMaterial?m="basic":d instanceof THREE.LineDashedMaterial?
|
|
|
+m="dashed":d instanceof THREE.PointCloudMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];d.__webglShader={uniforms:THREE.UniformsUtils.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,r=0,t=0,s=0,v=b.length;s<v;s++){var u=b[s];u.onlyShadow||!1===u.visible||(u instanceof THREE.DirectionalLight&&p++,u instanceof THREE.PointLight&&q++,u instanceof
|
|
|
+THREE.SpotLight&&r++,u instanceof THREE.HemisphereLight&&t++)}f=p;g=q;h=r;k=t;for(var x,y=0,L=0,F=b.length;L<F;L++){var A=b[L];A.castShadow&&(A instanceof THREE.SpotLight&&y++,A instanceof THREE.DirectionalLight&&!A.shadowCascade&&y++)}x=y;var C;if(Ub&&e&&e.skeleton&&e.skeleton.useVertexTexture)C=1024;else{var G=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),V=Math.floor((G-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(V=Math.min(e.skeleton.bones.length,V),V<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+
|
|
|
+e.skeleton.bones.length+", this GPU supports just "+V+" (try OpenGL instead of ANGLE)"));C=V}var K={precision:Q,supportsVertexTextures:Mb,map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:La,skinning:d.skinning,maxBones:C,useVertexTexture:Ub&&e&&e.skeleton&&e.skeleton.useVertexTexture,
|
|
|
+morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:J.maxMorphTargets,maxMorphNormals:J.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:x,shadowMapEnabled:J.shadowMapEnabled&&e.receiveShadow&&0<x,shadowMapType:J.shadowMapType,shadowMapDebug:J.shadowMapDebug,shadowMapCascade:J.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},I=[];m?I.push(m):
|
|
|
+(I.push(d.fragmentShader),I.push(d.vertexShader));if(void 0!==d.defines)for(var N in d.defines)I.push(N),I.push(d.defines[N]);for(N in K)I.push(N),I.push(K[N]);for(var X=I.join(),oa,Ca=0,db=Wa.length;Ca<db;Ca++){var Ia=Wa[Ca];if(Ia.code===X){oa=Ia;oa.usedTimes++;break}}void 0===oa&&(oa=new THREE.WebGLProgram(J,X,d,K),Wa.push(oa),J.info.memory.programs=Wa.length);d.program=oa;var Sa=oa.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var aa,ca="morphTarget",xa=0;xa<J.maxMorphTargets;xa++)aa=
|
|
|
+ca+xa,0<=Sa[aa]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,ca="morphNormal",xa=0;xa<J.maxMorphNormals;xa++)aa=ca+xa,0<=Sa[aa]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var eb in d.__webglShader.uniforms){var fb=d.program.uniforms[eb];fb&&d.uniformsList.push([d.__webglShader.uniforms[eb],fb])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(J.maxMorphTargets));var qa=!1,pa=!1,Ba=!1,wa=
|
|
|
+d.program,ga=wa.uniforms,O=d.__webglShader.uniforms;wa.id!==Vb&&(l.useProgram(wa.program),Vb=wa.id,Ba=pa=qa=!0);d.id!==Cb&&(-1===Cb&&(Ba=!0),Cb=d.id,pa=!0);if(qa||a!==Jb)l.uniformMatrix4fv(ga.projectionMatrix,!1,a.projectionMatrix.elements),La&&l.uniform1f(ga.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Jb&&(Jb=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==ga.cameraPosition&&(Da.setFromMatrixPosition(a.matrixWorld),l.uniform3f(ga.cameraPosition,
|
|
|
+Da.x,Da.y,Da.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==ga.viewMatrix&&l.uniformMatrix4fv(ga.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==ga.bindMatrix&&l.uniformMatrix4fv(ga.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==ga.bindMatrixInverse&&l.uniformMatrix4fv(ga.bindMatrixInverse,!1,e.bindMatrixInverse.elements),
|
|
|
+Ub&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ga.boneTexture){var ab=z();l.uniform1i(ga.boneTexture,ab);J.setTexture(e.skeleton.boneTexture,ab)}null!==ga.boneTextureWidth&&l.uniform1i(ga.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ga.boneTextureHeight&&l.uniform1i(ga.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ga.boneGlobalMatrices&&l.uniformMatrix4fv(ga.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(pa){c&&d.fog&&(O.fogColor.value=
|
|
|
+c.color,c instanceof THREE.Fog?(O.fogNear.value=c.near,O.fogFar.value=c.far):c instanceof THREE.FogExp2&&(O.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Nb){var Ba=!0,fa,gb,Y,Ra=0,Xa=0,bb=0,ya,Fa,jb,ma,Ya,kb,ka=mc,Ma=ka.directional.colors,Ta=ka.directional.positions,nb=ka.point.colors,mb=ka.point.positions,zb=ka.point.distances,Ua=ka.spot.colors,Ga=ka.spot.positions,ob=ka.spot.distances,Na=ka.spot.directions,ha=ka.spot.anglesCos,
|
|
|
+ra=ka.spot.exponents,H=ka.hemi.skyColors,za=ka.hemi.groundColors,Za=ka.hemi.positions,vb=0,pb=0,Oa=0,Aa=0,$a=0,Ja=0,Ka=0,ib=0,wb=0,qb=0,B=0,cb=0;fa=0;for(gb=b.length;fa<gb;fa++)Y=b[fa],Y.onlyShadow||(ya=Y.color,ma=Y.intensity,kb=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(J.gammaInput?(Ra+=ya.r*ya.r,Xa+=ya.g*ya.g,bb+=ya.b*ya.b):(Ra+=ya.r,Xa+=ya.g,bb+=ya.b)):Y instanceof THREE.DirectionalLight?($a+=1,Y.visible&&(la.setFromMatrixPosition(Y.matrixWorld),Da.setFromMatrixPosition(Y.target.matrixWorld),
|
|
|
+la.sub(Da),la.normalize(),wb=3*vb,Ta[wb]=la.x,Ta[wb+1]=la.y,Ta[wb+2]=la.z,J.gammaInput?D(Ma,wb,ya,ma*ma):w(Ma,wb,ya,ma),vb+=1)):Y instanceof THREE.PointLight?(Ja+=1,Y.visible&&(qb=3*pb,J.gammaInput?D(nb,qb,ya,ma*ma):w(nb,qb,ya,ma),Da.setFromMatrixPosition(Y.matrixWorld),mb[qb]=Da.x,mb[qb+1]=Da.y,mb[qb+2]=Da.z,zb[pb]=kb,pb+=1)):Y instanceof THREE.SpotLight?(Ka+=1,Y.visible&&(B=3*Oa,J.gammaInput?D(Ua,B,ya,ma*ma):w(Ua,B,ya,ma),la.setFromMatrixPosition(Y.matrixWorld),Ga[B]=la.x,Ga[B+1]=la.y,Ga[B+2]=la.z,
|
|
|
+ob[Oa]=kb,Da.setFromMatrixPosition(Y.target.matrixWorld),la.sub(Da),la.normalize(),Na[B]=la.x,Na[B+1]=la.y,Na[B+2]=la.z,ha[Oa]=Math.cos(Y.angle),ra[Oa]=Y.exponent,Oa+=1)):Y instanceof THREE.HemisphereLight&&(ib+=1,Y.visible&&(la.setFromMatrixPosition(Y.matrixWorld),la.normalize(),cb=3*Aa,Za[cb]=la.x,Za[cb+1]=la.y,Za[cb+2]=la.z,Fa=Y.color,jb=Y.groundColor,J.gammaInput?(Ya=ma*ma,D(H,cb,Fa,Ya),D(za,cb,jb,Ya)):(w(H,cb,Fa,ma),w(za,cb,jb,ma)),Aa+=1)));fa=3*vb;for(gb=Math.max(Ma.length,3*$a);fa<gb;fa++)Ma[fa]=
|
|
|
+0;fa=3*pb;for(gb=Math.max(nb.length,3*Ja);fa<gb;fa++)nb[fa]=0;fa=3*Oa;for(gb=Math.max(Ua.length,3*Ka);fa<gb;fa++)Ua[fa]=0;fa=3*Aa;for(gb=Math.max(H.length,3*ib);fa<gb;fa++)H[fa]=0;fa=3*Aa;for(gb=Math.max(za.length,3*ib);fa<gb;fa++)za[fa]=0;ka.directional.length=vb;ka.point.length=pb;ka.spot.length=Oa;ka.hemi.length=Aa;ka.ambient[0]=Ra;ka.ambient[1]=Xa;ka.ambient[2]=bb;Nb=!1}if(Ba){var sa=mc;O.ambientLightColor.value=sa.ambient;O.directionalLightColor.value=sa.directional.colors;O.directionalLightDirection.value=
|
|
|
+sa.directional.positions;O.pointLightColor.value=sa.point.colors;O.pointLightPosition.value=sa.point.positions;O.pointLightDistance.value=sa.point.distances;O.spotLightColor.value=sa.spot.colors;O.spotLightPosition.value=sa.spot.positions;O.spotLightDistance.value=sa.spot.distances;O.spotLightDirection.value=sa.spot.directions;O.spotLightAngleCos.value=sa.spot.anglesCos;O.spotLightExponent.value=sa.spot.exponents;O.hemisphereLightSkyColor.value=sa.hemi.skyColors;O.hemisphereLightGroundColor.value=
|
|
|
+sa.hemi.groundColors;O.hemisphereLightDirection.value=sa.hemi.positions;E(O,!0)}else E(O,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){O.opacity.value=d.opacity;J.gammaInput?O.diffuse.value.copyGammaToLinear(d.color):O.diffuse.value=d.color;O.map.value=d.map;O.lightMap.value=d.lightMap;O.specularMap.value=d.specularMap;O.alphaMap.value=d.alphaMap;d.bumpMap&&(O.bumpMap.value=d.bumpMap,O.bumpScale.value=d.bumpScale);d.normalMap&&
|
|
|
+(O.normalMap.value=d.normalMap,O.normalScale.value.copy(d.normalScale));var na;d.map?na=d.map:d.specularMap?na=d.specularMap:d.normalMap?na=d.normalMap:d.bumpMap?na=d.bumpMap:d.alphaMap&&(na=d.alphaMap);if(void 0!==na){var ub=na.offset,yb=na.repeat;O.offsetRepeat.value.set(ub.x,ub.y,yb.x,yb.y)}O.envMap.value=d.envMap;O.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;O.reflectivity.value=d.reflectivity;O.refractionRatio.value=d.refractionRatio;O.combine.value=d.combine;O.useRefract.value=
|
|
|
+d.envMap&&(d.envMap.mapping===THREE.CubeRefractionMapping||d.envMap.mapping===THREE.EquirectangularRefractionMapping)}d instanceof THREE.LineBasicMaterial?(O.diffuse.value=d.color,O.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(O.diffuse.value=d.color,O.opacity.value=d.opacity,O.dashSize.value=d.dashSize,O.totalSize.value=d.dashSize+d.gapSize,O.scale.value=d.scale):d instanceof THREE.PointCloudMaterial?(O.psColor.value=d.color,O.opacity.value=d.opacity,O.size.value=d.size,O.scale.value=
|
|
|
+P.height/2,O.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(O.shininess.value=d.shininess,J.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive),O.specular.value.copyGammaToLinear(d.specular)):(O.ambient.value=d.ambient,O.emissive.value=d.emissive,O.specular.value=d.specular),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(J.gammaInput?(O.ambient.value.copyGammaToLinear(d.ambient),O.emissive.value.copyGammaToLinear(d.emissive)):
|
|
|
+(O.ambient.value=d.ambient,O.emissive.value=d.emissive),d.wrapAround&&O.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(O.mNear.value=a.near,O.mFar.value=a.far,O.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(O.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&O.shadowMatrix)for(var Ab=0,tb=0,Xb=b.length;tb<Xb;tb++){var lb=b[tb];lb.castShadow&&(lb instanceof THREE.SpotLight||lb instanceof THREE.DirectionalLight&&!lb.shadowCascade)&&(O.shadowMap.value[Ab]=
|
|
|
+lb.shadowMap,O.shadowMapSize.value[Ab]=lb.shadowMapSize,O.shadowMatrix.value[Ab]=lb.shadowMatrix,O.shadowDarkness.value[Ab]=lb.shadowDarkness,O.shadowBias.value[Ab]=lb.shadowBias,Ab++)}for(var Db=d.uniformsList,W,Ha,Va,Eb=0,Ob=Db.length;Eb<Ob;Eb++){var $=Db[Eb][0];if(!1!==$.needsUpdate){var Fb=$.type,R=$.value,S=Db[Eb][1];switch(Fb){case "1i":l.uniform1i(S,R);break;case "1f":l.uniform1f(S,R);break;case "2f":l.uniform2f(S,R[0],R[1]);break;case "3f":l.uniform3f(S,R[0],R[1],R[2]);break;case "4f":l.uniform4f(S,
|
|
|
+R[0],R[1],R[2],R[3]);break;case "1iv":l.uniform1iv(S,R);break;case "3iv":l.uniform3iv(S,R);break;case "1fv":l.uniform1fv(S,R);break;case "2fv":l.uniform2fv(S,R);break;case "3fv":l.uniform3fv(S,R);break;case "4fv":l.uniform4fv(S,R);break;case "Matrix3fv":l.uniformMatrix3fv(S,!1,R);break;case "Matrix4fv":l.uniformMatrix4fv(S,!1,R);break;case "i":l.uniform1i(S,R);break;case "f":l.uniform1f(S,R);break;case "v2":l.uniform2f(S,R.x,R.y);break;case "v3":l.uniform3f(S,R.x,R.y,R.z);break;case "v4":l.uniform4f(S,
|
|
|
+R.x,R.y,R.z,R.w);break;case "c":l.uniform3f(S,R.r,R.g,R.b);break;case "iv1":l.uniform1iv(S,R);break;case "iv":l.uniform3iv(S,R);break;case "fv1":l.uniform1fv(S,R);break;case "fv":l.uniform3fv(S,R);break;case "v2v":void 0===$._array&&($._array=new Float32Array(2*R.length));for(var Z=0,Ea=R.length;Z<Ea;Z++)Va=2*Z,$._array[Va]=R[Z].x,$._array[Va+1]=R[Z].y;l.uniform2fv(S,$._array);break;case "v3v":void 0===$._array&&($._array=new Float32Array(3*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)Va=3*Z,$._array[Va]=
|
|
|
+R[Z].x,$._array[Va+1]=R[Z].y,$._array[Va+2]=R[Z].z;l.uniform3fv(S,$._array);break;case "v4v":void 0===$._array&&($._array=new Float32Array(4*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)Va=4*Z,$._array[Va]=R[Z].x,$._array[Va+1]=R[Z].y,$._array[Va+2]=R[Z].z,$._array[Va+3]=R[Z].w;l.uniform4fv(S,$._array);break;case "m3":l.uniformMatrix3fv(S,!1,R.elements);break;case "m3v":void 0===$._array&&($._array=new Float32Array(9*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)R[Z].flattenToArrayOffset($._array,9*Z);l.uniformMatrix3fv(S,
|
|
|
+!1,$._array);break;case "m4":l.uniformMatrix4fv(S,!1,R.elements);break;case "m4v":void 0===$._array&&($._array=new Float32Array(16*R.length));Z=0;for(Ea=R.length;Z<Ea;Z++)R[Z].flattenToArrayOffset($._array,16*Z);l.uniformMatrix4fv(S,!1,$._array);break;case "t":W=R;Ha=z();l.uniform1i(S,Ha);if(!W)continue;if(W instanceof THREE.CubeTexture||W.image instanceof Array&&6===W.image.length){var ja=W,Bb=Ha;if(6===ja.image.length)if(ja.needsUpdate){ja.image.__webglTextureCube||(ja.addEventListener("dispose",
|
|
|
+Wb),ja.image.__webglTextureCube=l.createTexture(),J.info.memory.textures++);l.activeTexture(l.TEXTURE0+Bb);l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,ja.flipY);for(var Gb=ja instanceof THREE.CompressedTexture,ba=ja.image[0]instanceof THREE.DataTexture,hb=[],ta=0;6>ta;ta++)hb[ta]=!J.autoScaleCubemaps||Gb||ba?ba?ja.image[ta].image:ja.image[ta]:M(ja.image[ta],Cc);var Pb=hb[0],Qb=THREE.Math.isPowerOfTwo(Pb.width)&&THREE.Math.isPowerOfTwo(Pb.height),
|
|
|
+rb=T(ja.format),Rb=T(ja.type);U(l.TEXTURE_CUBE_MAP,ja,Qb);for(ta=0;6>ta;ta++)if(Gb)for(var xb,Hb=hb[ta].mipmaps,sb=0,Yb=Hb.length;sb<Yb;sb++)xb=Hb[sb],ja.format!==THREE.RGBAFormat&&ja.format!==THREE.RGBFormat?-1<nc().indexOf(rb)?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,sb,rb,xb.width,xb.height,0,xb.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,sb,rb,xb.width,xb.height,0,rb,Rb,xb.data);else ba?l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+ta,0,rb,hb[ta].width,hb[ta].height,0,rb,Rb,hb[ta].data):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+ta,0,rb,rb,Rb,hb[ta]);ja.generateMipmaps&&Qb&&l.generateMipmap(l.TEXTURE_CUBE_MAP);ja.needsUpdate=!1;if(ja.onUpdate)ja.onUpdate()}else l.activeTexture(l.TEXTURE0+Bb),l.bindTexture(l.TEXTURE_CUBE_MAP,ja.image.__webglTextureCube)}else if(W instanceof THREE.WebGLRenderTargetCube){var Zb=W;l.activeTexture(l.TEXTURE0+Ha);l.bindTexture(l.TEXTURE_CUBE_MAP,Zb.__webglTexture)}else J.setTexture(W,Ha);break;case "tv":void 0===
|
|
|
+$._array&&($._array=[]);Z=0;for(Ea=$.value.length;Z<Ea;Z++)$._array[Z]=z();l.uniform1iv(S,$._array);Z=0;for(Ea=$.value.length;Z<Ea;Z++)W=$.value[Z],Ha=$._array[Z],W&&J.setTexture(W,Ha);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Fb)}}}}l.uniformMatrix4fv(ga.modelViewMatrix,!1,e._modelViewMatrix.elements);ga.normalMatrix&&l.uniformMatrix3fv(ga.normalMatrix,!1,e._normalMatrix.elements);null!==ga.modelMatrix&&l.uniformMatrix4fv(ga.modelMatrix,!1,e.matrixWorld.elements);return wa}
|
|
|
+function E(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.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=
|
|
|
+b;a.hemisphereLightDirection.needsUpdate=b}function z(){var a=Ib;a>=oc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+oc);Ib+=1;return a}function F(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function D(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function w(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function C(a){a!==pc&&(l.lineWidth(a),pc=a)}function A(a,
|
|
|
+b,c){qc!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),qc=a);!a||rc===b&&sc===c||(l.polygonOffset(b,c),rc=b,sc=c)}function U(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,T(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,T(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,T(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,T(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.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 is set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),l.texParameteri(a,l.TEXTURE_MAG_FILTER,N(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,N(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter is set to THREE.LinearFilter or THREE.NearestFilter. ( "+
|
|
|
+b.sourceFile+" )"));(c=aa.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(l.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,J.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function M(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.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+".");return d}return a}function I(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,
|
|
|
+l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function K(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))}function N(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
|
|
|
+l.NEAREST:l.LINEAR}function T(a){var b;if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===
|
|
|
THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;
|
|
|
if(a===THREE.FloatType)return l.FLOAT;if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===
|
|
|
THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;
|
|
|
b=aa.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=aa.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
|
-if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=aa.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),N=void 0!==a.context?a.context:null,R=void 0!==a.precision?a.precision:"highp",pa=
|
|
|
-void 0!==a.alpha?a.alpha:!1,ba=void 0!==a.depth?a.depth:!0,ta=void 0!==a.stencil?a.stencil:!0,Q=void 0!==a.antialias?a.antialias:!1,La=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Ga=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,W=new THREE.Color(0),fb=0,oa=[],za={},Ha=[],wa=[],Ua=[],hb=[],ib=[];this.domElement=F;this.context=null;this.devicePixelRatio=void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=
|
|
|
-this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var A=this,Wa=[],Xb=null,uc=null,Kb=-1,eb=-1,Fb=null,Jb=0,Ab=-1,
|
|
|
-ub=-1,Qb=-1,Zb=-1,ec=-1,fc=-1,gc=-1,hc=-1,rc=null,sc=null,tc=null,qc=null,Gb=0,mb=0,Xa=F.width,vb=F.height,vc=0,wc=0,qb=new Uint8Array(16),Ta=new Uint8Array(16),nb=new THREE.Frustum,Bb=new THREE.Matrix4;new THREE.Matrix4;var Aa=new THREE.Vector3,ma=new THREE.Vector3,Pb=!0,nc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],
|
|
|
-groundColors:[],positions:[]}},l;try{var xc={alpha:pa,depth:ba,stencil:ta,antialias:Q,premultipliedAlpha:La,preserveDrawingBuffer:qa};l=N||F.getContext("webgl",xc)||F.getContext("experimental-webgl",xc);if(null===l){if(null!==F.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}F.addEventListener("webglcontextlost",function(a){a.preventDefault();yc();zc();za={}},!1)}catch(Ec){console.error(Ec)}void 0===l.getShaderPrecisionFormat&&
|
|
|
-(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var aa=new THREE.WebGLExtensions(l);aa.get("OES_texture_float");aa.get("OES_texture_float_linear");aa.get("OES_standard_derivatives");Ga&&aa.get("EXT_frag_depth");var zc=function(){l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);
|
|
|
-l.viewport(Gb,mb,Xa,vb);l.clearColor(W.r,W.g,W.b,fb)},yc=function(){Fb=Xb=null;Kb=eb=ub=Ab=hc=gc=Qb=-1;Pb=!0;for(var a=0;a<Ta.length;a++)Ta[a]=0};zc();this.context=l;var pc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Fc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Gc=l.getParameter(l.MAX_TEXTURE_SIZE),Dc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Ob=0<Fc,Wb=Ob&&aa.get("OES_texture_float"),Hc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),Ic=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
|
|
|
-l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var Jc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),Kc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var oc=function(){var a;return function(){if(void 0!==a)return a;a=[];if(aa.get("WEBGL_compressed_texture_pvrtc")||aa.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);
|
|
|
-return a}}(),Lc=0<Hc.precision&&0<Jc.precision,Ac=0<Ic.precision&&0<Kc.precision;"highp"!==R||Lc||(Ac?(R="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(R="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==R||Ac||(R="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var Mc=new THREE.ShadowMapPlugin(this,oa,za,Ha),Nc=new THREE.SpritePlugin(this,hb),Oc=new THREE.LensFlarePlugin(this,
|
|
|
-ib);this.getContext=function(){return l};this.forceContextLoss=function(){aa.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return Ob};this.supportsFloatTextures=function(){return aa.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return aa.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return aa.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return aa.get("WEBGL_compressed_texture_pvrtc")};
|
|
|
-this.supportsBlendMinMax=function(){return aa.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=aa.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return R};this.setSize=function(a,b,c){F.width=a*this.devicePixelRatio;F.height=b*this.devicePixelRatio;!1!==c&&(F.style.width=a+"px",F.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=
|
|
|
-function(a,b,c,d){Gb=a*this.devicePixelRatio;mb=b*this.devicePixelRatio;Xa=c*this.devicePixelRatio;vb=d*this.devicePixelRatio;l.viewport(Gb,mb,Xa,vb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){W.set(a);fb=void 0!==b?b:1;l.clearColor(W.r,W.g,W.b,fb)};this.setClearColorHex=function(a,
|
|
|
-b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return W};this.getClearAlpha=function(){return fb};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=
|
|
|
-function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=yc;var ic=function(a){a.target.traverse(function(a){a.removeEventListener("remove",ic);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete za[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=Ha,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;
|
|
|
-delete a._normalMatrix;delete a.__webglActive})},jc=function(a){a=a.target;a.removeEventListener("dispose",jc);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}A.info.memory.geometries--}else if(b=gb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);
|
|
|
-delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.numMorphNormals;f<g;f++)l.deleteBuffer(e.__webglMorphNormalsBuffers[f]);delete e.__webglMorphNormalsBuffers}Bc(e)}delete gb[a.id]}else Bc(a);eb=-1},Yb=function(a){a=a.target;a.removeEventListener("dispose",Yb);a.image&&a.image.__webglTextureCube?(l.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(l.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);
|
|
|
-A.info.memory.textures--},Cc=function(a){a=a.target;a.removeEventListener("dispose",Cc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}A.info.memory.textures--},
|
|
|
-mc=function(a){a=a.target;a.removeEventListener("dispose",mc);lc(a)},Bc=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(l.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[e].buffer);
|
|
|
-delete a.__webglCustomAttributesList}A.info.memory.geometries--},lc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Wa.length;a<c;a++)if(d=Wa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Wa.length;a<c;a++)d=Wa[a],d.program!==b&&e.push(d);Wa=e;l.deleteProgram(b);A.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){f();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());
|
|
|
+if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=aa.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var P=void 0!==a.canvas?a.canvas:document.createElement("canvas"),X=void 0!==a.context?a.context:null,Q=void 0!==a.precision?a.precision:"highp",pa=
|
|
|
+void 0!==a.alpha?a.alpha:!1,ca=void 0!==a.depth?a.depth:!0,Ba=void 0!==a.stencil?a.stencil:!0,G=void 0!==a.antialias?a.antialias:!1,wa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,La=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,V=new THREE.Color(0),db=0,oa=[],Ca={},Ia=[],xa=[],Sa=[],eb=[],fb=[];this.domElement=P;this.context=null;this.devicePixelRatio=void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=
|
|
|
+this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var J=this,Wa=[],Vb=null,tc=null,Cb=-1,ab=-1,Jb=null,Ib=0,mb=-1,
|
|
|
+yb=-1,Xb=-1,Yb=-1,Zb=-1,ec=-1,fc=-1,gc=-1,qc=null,rc=null,sc=null,pc=null,tb=0,bb=0,Xa=P.width,zb=P.height,uc=0,vc=0,ib=new Uint8Array(16),Ra=new Uint8Array(16),kb=new THREE.Frustum,ub=new THREE.Matrix4;new THREE.Matrix4;var Da=new THREE.Vector3,la=new THREE.Vector3,Nb=!0,mc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],
|
|
|
+groundColors:[],positions:[]}},l;try{var wc={alpha:pa,depth:ca,stencil:Ba,antialias:G,premultipliedAlpha:wa,preserveDrawingBuffer:qa};l=X||P.getContext("webgl",wc)||P.getContext("experimental-webgl",wc);if(null===l){if(null!==P.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}P.addEventListener("webglcontextlost",function(a){a.preventDefault();xc();yc();Ca={}},!1)}catch(Dc){console.error(Dc)}void 0===l.getShaderPrecisionFormat&&
|
|
|
+(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var aa=new THREE.WebGLExtensions(l);aa.get("OES_texture_float");aa.get("OES_texture_float_linear");aa.get("OES_standard_derivatives");La&&aa.get("EXT_frag_depth");var yc=function(){l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);
|
|
|
+l.viewport(tb,bb,Xa,zb);l.clearColor(V.r,V.g,V.b,db)},xc=function(){Jb=Vb=null;Cb=ab=yb=mb=gc=fc=Xb=-1;Nb=!0;for(var a=0;a<Ra.length;a++)Ra[a]=0};yc();this.context=l;var oc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Ec=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Fc=l.getParameter(l.MAX_TEXTURE_SIZE),Cc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Mb=0<Ec,Ub=Mb&&aa.get("OES_texture_float"),Gc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),Hc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
|
|
|
+l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var Ic=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),Jc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var nc=function(){var a;return function(){if(void 0!==a)return a;a=[];if(aa.get("WEBGL_compressed_texture_pvrtc")||aa.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);
|
|
|
+return a}}(),Kc=0<Gc.precision&&0<Ic.precision,zc=0<Hc.precision&&0<Jc.precision;"highp"!==Q||Kc||(zc?(Q="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(Q="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==Q||zc||(Q="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var Lc=new THREE.ShadowMapPlugin(this,oa,Ca,Ia),Mc=new THREE.SpritePlugin(this,eb),Nc=new THREE.LensFlarePlugin(this,
|
|
|
+fb);this.getContext=function(){return l};this.forceContextLoss=function(){aa.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return Mb};this.supportsFloatTextures=function(){return aa.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return aa.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return aa.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return aa.get("WEBGL_compressed_texture_pvrtc")};
|
|
|
+this.supportsBlendMinMax=function(){return aa.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=aa.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return Q};this.setSize=function(a,b,c){P.width=a*this.devicePixelRatio;P.height=b*this.devicePixelRatio;!1!==c&&(P.style.width=a+"px",P.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=
|
|
|
+function(a,b,c,d){tb=a*this.devicePixelRatio;bb=b*this.devicePixelRatio;Xa=c*this.devicePixelRatio;zb=d*this.devicePixelRatio;l.viewport(tb,bb,Xa,zb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){V.set(a);db=void 0!==b?b:1;l.clearColor(V.r,V.g,V.b,db)};this.setClearColorHex=function(a,
|
|
|
+b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return V};this.getClearAlpha=function(){return db};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=
|
|
|
+function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=xc;var hc=function(a){a.target.traverse(function(a){a.removeEventListener("remove",hc);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete Ca[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=Ia,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;
|
|
|
+delete a._normalMatrix;delete a.__webglActive})},ic=function(a){a=a.target;a.removeEventListener("dispose",ic);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}J.info.memory.geometries--}else if(b=jb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);
|
|
|
+delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.numMorphNormals;f<g;f++)l.deleteBuffer(e.__webglMorphNormalsBuffers[f]);delete e.__webglMorphNormalsBuffers}Ac(e)}delete jb[a.id]}else Ac(a);ab=-1},Wb=function(a){a=a.target;a.removeEventListener("dispose",Wb);a.image&&a.image.__webglTextureCube?(l.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(l.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);
|
|
|
+J.info.memory.textures--},Bc=function(a){a=a.target;a.removeEventListener("dispose",Bc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}J.info.memory.textures--},
|
|
|
+lc=function(a){a=a.target;a.removeEventListener("dispose",lc);kc(a)},Ac=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(l.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[e].buffer);
|
|
|
+delete a.__webglCustomAttributesList}J.info.memory.geometries--},kc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Wa.length;a<c;a++)if(d=Wa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Wa.length;a<c;a++)d=Wa[a],d.program!==b&&e.push(d);Wa=e;l.deleteProgram(b);J.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){f();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());
|
|
|
a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),g(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);
|
|
|
-if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,q,s,t,r,v,w=3*a.count;for(v=0;v<w;v+=9)r=a.normalArray,d=r[v],e=r[v+1],k=r[v+2],m=r[v+3],p=r[v+4],s=r[v+5],n=r[v+6],q=r[v+7],t=r[v+8],d=(d+m+n)/3,e=(e+p+q)/3,k=(k+s+t)/3,r[v]=d,r[v+1]=e,r[v+2]=k,r[v+3]=d,r[v+4]=e,r[v+5]=k,r[v+6]=d,r[v+7]=e,r[v+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);g(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),
|
|
|
-l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),g(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),g(b.attributes.color),l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,g,h){if(!1!==d.visible)if(w(h),a=v(a,b,c,d,
|
|
|
-h),b=!1,c=16777215*g.id+2*a.id+(d.wireframe?1:0),c!==eb&&(eb=c,b=!0),b&&f(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=g.attributes.index){var k,m;c.array instanceof Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=g.offsets;if(0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),A.info.render.calls++,A.info.render.vertices+=c.array.length,A.info.render.faces+=c.array.length/
|
|
|
-3;else{b=!0;for(var p=0,q=n.length;p<q;p++){var r=n[p].index;b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);A.info.render.calls++;A.info.render.vertices+=n[p].count;A.info.render.faces+=n[p].count/3}}}else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),A.info.render.calls++,A.info.render.vertices+=d.array.length/3,A.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)if(h=l.POINTS,c=g.attributes.index)if(c.array instanceof
|
|
|
-Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),A.info.render.calls++,A.info.render.points+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),A.info.render.calls++,A.info.render.points+=n[p].count;
|
|
|
-else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),A.info.render.calls++,A.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,D(d.linewidth),c=g.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),A.info.render.calls++,A.info.render.vertices+=
|
|
|
-c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),A.info.render.calls++,A.info.render.vertices+=n[p].count;else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),A.info.render.calls++,A.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){w(k);c=v(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+
|
|
|
-(d.wireframe?1:0);c!==eb&&(eb=c,a=!0);a&&f();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),g(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(c.position),
|
|
|
+if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,q,r,t,s,v,u=3*a.count;for(v=0;v<u;v+=9)s=a.normalArray,d=s[v],e=s[v+1],k=s[v+2],m=s[v+3],p=s[v+4],r=s[v+5],n=s[v+6],q=s[v+7],t=s[v+8],d=(d+m+n)/3,e=(e+p+q)/3,k=(k+r+t)/3,s[v]=d,s[v+1]=e,s[v+2]=k,s[v+3]=d,s[v+4]=e,s[v+5]=k,s[v+6]=d,s[v+7]=e,s[v+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);g(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),
|
|
|
+l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),g(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),g(b.attributes.color),l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,g,h){if(!1!==d.visible)if(v(h),a=x(a,b,c,d,
|
|
|
+h),b=!1,c=16777215*g.id+2*a.id+(d.wireframe?1:0),c!==ab&&(ab=c,b=!0),b&&f(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=g.attributes.index){var k,m;c.array instanceof Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=g.offsets;if(0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=c.array.length,J.info.render.faces+=c.array.length/
|
|
|
+3;else{b=!0;for(var p=0,q=n.length;p<q;p++){var r=n[p].index;b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);J.info.render.calls++;J.info.render.vertices+=n[p].count;J.info.render.faces+=n[p].count/3}}}else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.vertices+=d.array.length/3,J.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)if(h=l.POINTS,c=g.attributes.index)if(c.array instanceof
|
|
|
+Uint32Array&&aa.get("OES_element_index_uint")?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.points+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),J.info.render.calls++,J.info.render.points+=n[p].count;
|
|
|
+else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,C(d.linewidth),c=g.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=g.offsets,0===n.length)b&&(e(d,a,g,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=
|
|
|
+c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,g,r),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),J.info.render.calls++,J.info.render.vertices+=n[p].count;else b&&e(d,a,g,0),d=g.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){v(k);c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+
|
|
|
+(d.wireframe?1:0);c!==ab&&(ab=c,a=!0);a&&f();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),g(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),g(c.position),
|
|
|
l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var m=0,n=k.morphTargetForcedOrder,q=k.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<n.length;)0<=c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[m]]),g(c["morphTarget"+m]),l.vertexAttribPointer(c["morphTarget"+m],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[m]]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+
|
|
|
m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[n[m]],m++;else{var n=[],q=k.morphTargetInfluences,r,s=q.length;for(r=0;r<s;r++)m=q[r],0<m&&n.push([m,r]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)n[m]?(r=n[m][1],0<=c["morphTarget"+m]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[r]),g(c["morphTarget"+m]),l.vertexAttribPointer(c["morphTarget"+
|
|
|
m],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[r]),g(c["morphNormal"+m]),l.vertexAttribPointer(c["morphNormal"+m],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[m]=q[r]):k.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c=0,q=e.__webglCustomAttributesList.length;c<
|
|
|
q;c++)n=e.__webglCustomAttributesList[c],0<=b[n.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,n.buffer),g(b[n.buffer.belongsToAttribute]),l.vertexAttribPointer(b[n.buffer.belongsToAttribute],n.size,l.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),g(b.color),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=
|
|
|
b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),g(b.normal),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),g(b.tangent),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),g(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?
|
|
|
(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),g(b.uv2),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&
|
|
|
-(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(D(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),A.info.render.calls++,
|
|
|
-A.info.render.vertices+=e.__webglFaceCount,A.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,D(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),A.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),A.info.render.calls++,A.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{var e=a.fog;Kb=eb=-1;Fb=null;Pb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);Bb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);nb.setFromMatrix(Bb);oa.length=0;wa.length=0;Ua.length=0;hb.length=0;ib.length=0;q(a);!0===A.sortObjects&&(wa.sort(k),Ua.sort(n));Mc.render(a,b);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=
|
|
|
-0;A.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=Ha.length;d<f;d++){var g=Ha[d],h=g.object;h.visible&&(C(h,b),s(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(wa,b,oa,e,!0,d),m(Ua,b,oa,e,!0,d),t(Ha,"",
|
|
|
-b,oa,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(wa,b,oa,e,!1,d),t(Ha,"opaque",b,oa,e,!1,d),m(Ua,b,oa,e,!0,d),t(Ha,"transparent",b,oa,e,!0,d));Nc.render(a,b);Oc.render(a,b,vc,wc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&K(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=v(a,b,c,d,e);eb=-1;A.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,nb):e.render(function(a){A.renderBufferImmediate(a,
|
|
|
-f,d)})};var gb={},kc=0;this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;Ab!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Ab=b);ub!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),
|
|
|
-ub=a)};this.setDepthTest=function(a){gc!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),gc=a)};this.setDepthWrite=function(a){hc!==a&&(l.depthMask(a),hc=a)};this.setBlending=function(a,b,c,d){a!==Qb&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?
|
|
|
-(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),Qb=a);if(a===THREE.CustomBlending){if(b!==Zb&&(l.blendEquation(V(b)),Zb=b),c!==ec||d!==fc)l.blendFunc(V(c),V(d)),ec=c,fc=d}else fc=ec=Zb=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",
|
|
|
-Yb),a.__webglTexture=l.createTexture(),A.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=M(a.image,Gc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=V(a.format),e=V(a.type);U(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=
|
|
|
-0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<oc().indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,
|
|
|
-b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?A.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
-if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Cc);a.__webglTexture=l.createTexture();A.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=V(a.format),e=V(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);U(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();
|
|
|
-a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);J(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),
|
|
|
+(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(C(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),J.info.render.calls++,
|
|
|
+J.info.render.vertices+=e.__webglFaceCount,J.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.mode===THREE.LineStrip?l.LINE_STRIP:l.LINES,C(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),J.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),J.info.render.calls++,J.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{var e=a.fog;Cb=ab=-1;Jb=null;Nb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);ub.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);kb.setFromMatrix(ub);oa.length=0;xa.length=0;Sa.length=0;eb.length=0;fb.length=0;q(a);!0===J.sortObjects&&(xa.sort(k),Sa.sort(n));Lc.render(a,b);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=
|
|
|
+0;J.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=Ia.length;d<f;d++){var g=Ia[d],h=g.object;h.visible&&(F(h,b),s(g))}a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),A(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(xa,b,oa,e,!0,d),m(Sa,b,oa,e,!0,d),t(Ia,"",
|
|
|
+b,oa,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(xa,b,oa,e,!1,d),t(Ia,"opaque",b,oa,e,!1,d),m(Sa,b,oa,e,!0,d),t(Ia,"transparent",b,oa,e,!0,d));Mc.render(a,b);Nc.render(a,b,uc,vc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&K(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);ab=-1;J.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,kb):e.render(function(a){J.renderBufferImmediate(a,
|
|
|
+f,d)})};var jb={},jc=0;this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;mb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),mb=b);yb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),
|
|
|
+yb=a)};this.setDepthTest=function(a){fc!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),fc=a)};this.setDepthWrite=function(a){gc!==a&&(l.depthMask(a),gc=a)};this.setBlending=function(a,b,c,d){a!==Xb&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?
|
|
|
+(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),Xb=a);if(a===THREE.CustomBlending){if(b!==Yb&&(l.blendEquation(T(b)),Yb=b),c!==Zb||d!==ec)l.blendFunc(T(c),T(d)),Zb=c,ec=d}else ec=Zb=Yb=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",
|
|
|
+Wb),a.__webglTexture=l.createTexture(),J.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=M(a.image,Fc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=T(a.format),e=T(a.type);U(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=
|
|
|
+0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<nc().indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,
|
|
|
+b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?J.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
+if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Bc);a.__webglTexture=l.createTexture();J.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=T(a.format),e=T(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);U(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();
|
|
|
+a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);I(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),
|
|
|
l.bindTexture(l.TEXTURE_2D,a.__webglTexture),U(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,
|
|
|
-l.RENDERBUFFER,a.__webglRenderbuffer):J(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Xa,a=vb,d=Gb,e=mb);b!==uc&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),uc=b);vc=c;wc=a};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};
|
|
|
+l.RENDERBUFFER,a.__webglRenderbuffer):I(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Xa,a=zb,d=tb,e=bb);b!==tc&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),tc=b);uc=c;vc=a};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};
|
|
|
this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
@@ -583,53 +583,53 @@ b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap
|
|
|
"",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",t?"#define "+t:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.metal?"#define METAL":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?
|
|
|
"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+m:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));n=new THREE.WebGLShader(f,f.VERTEX_SHADER,d+n);p=new THREE.WebGLShader(f,f.FRAGMENT_SHADER,b+p);f.attachShader(g,n);f.attachShader(g,p);void 0!==q&&f.bindAttribLocation(g,0,q);f.linkProgram(g);!1===f.getProgramParameter(g,
|
|
|
f.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."),console.error("gl.VALIDATE_STATUS",f.getProgramParameter(g,f.VALIDATE_STATUS)),console.error("gl.getError()",f.getError()));""!==f.getProgramInfoLog(g)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",f.getProgramInfoLog(g));f.deleteShader(n);f.deleteShader(p);q="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" ");
|
|
|
-e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var w in h)q.push(w);h=q;w={};q=0;for(b=h.length;q<b;q++)m=h[q],w[m]=f.getUniformLocation(g,m);this.uniforms=w;q="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(h=0;h<e.maxMorphTargets;h++)q.push("morphTarget"+h);for(h=0;h<e.maxMorphNormals;h++)q.push("morphNormal"+h);for(var x in k)q.push(x);
|
|
|
-e=q;k={};x=0;for(h=e.length;x<h;x++)w=e[x],k[w]=f.getAttribLocation(g,w);this.attributes=k;this.attributesKeys=Object.keys(this.attributes);this.id=a++;this.code=c;this.usedTimes=1;this.program=g;this.vertexShader=n;this.fragmentShader=p;return this}}();
|
|
|
+e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var v in h)q.push(v);h=q;v={};q=0;for(b=h.length;q<b;q++)m=h[q],v[m]=f.getUniformLocation(g,m);this.uniforms=v;q="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(h=0;h<e.maxMorphTargets;h++)q.push("morphTarget"+h);for(h=0;h<e.maxMorphNormals;h++)q.push("morphNormal"+h);for(var y in k)q.push(y);
|
|
|
+e=q;k={};y=0;for(h=e.length;y<h;y++)v=e[y],k[v]=f.getAttribLocation(g,v);this.attributes=k;this.attributesKeys=Object.keys(this.attributes);this.id=a++;this.code=c;this.usedTimes=1;this.program=g;this.vertexShader=n;this.fragmentShader=p;return this}}();
|
|
|
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){c=b.createShader(c);b.shaderSource(c,d);b.compileShader(c);!1===b.getShaderParameter(c,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(c)&&(console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",b.getShaderInfoLog(c)),console.warn(a(d)));return c}}();
|
|
|
-THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m=a.context,t,s,r,u,w,x;this.render=function(L,v,y,z){if(0!==b.length){L=new THREE.Vector3;var C=z/y,G=.5*y,E=.5*z,D=16/z,I=new THREE.Vector2(D*C,D),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===r){var D=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),J=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();s=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,D,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
-s);m.bufferData(m.ELEMENT_ARRAY_BUFFER,J,m.STATIC_DRAW);w=m.createTexture();x=m.createTexture();m.bindTexture(m.TEXTURE_2D,w);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);m.bindTexture(m.TEXTURE_2D,x);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=(u=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}",
|
|
|
+THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m=a.context,t,s,r,u,v,y;this.render=function(L,x,E,z){if(0!==b.length){L=new THREE.Vector3;var F=z/E,D=.5*E,w=.5*z,C=16/z,A=new THREE.Vector2(C*F,C),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===r){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),I=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();s=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,C,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
+s);m.bufferData(m.ELEMENT_ARRAY_BUFFER,I,m.STATIC_DRAW);v=m.createTexture();y=m.createTexture();m.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);m.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 C=(u=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}"},
|
|
|
-J=m.createProgram(),K=m.createShader(m.FRAGMENT_SHADER),O=m.createShader(m.VERTEX_SHADER),V="precision "+a.getPrecision()+" float;\n";m.shaderSource(K,V+D.fragmentShader);m.shaderSource(O,V+D.vertexShader);m.compileShader(K);m.compileShader(O);m.attachShader(J,K);m.attachShader(J,O);m.linkProgram(J);r=J;p=m.getAttribLocation(r,"position");q=m.getAttribLocation(r,"uv");c=m.getUniformLocation(r,"renderType");d=m.getUniformLocation(r,"map");e=m.getUniformLocation(r,"occlusionMap");f=m.getUniformLocation(r,
|
|
|
-"opacity");g=m.getUniformLocation(r,"color");h=m.getUniformLocation(r,"scale");k=m.getUniformLocation(r,"rotation");n=m.getUniformLocation(r,"screenPosition")}m.useProgram(r);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,t);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,s);m.disable(m.CULL_FACE);m.depthMask(!1);J=0;for(K=b.length;J<K;J++)if(D=16/z,I.set(D*
|
|
|
-C,D),O=b[J],L.set(O.matrixWorld.elements[12],O.matrixWorld.elements[13],O.matrixWorld.elements[14]),L.applyMatrix4(v.matrixWorldInverse),L.applyProjection(v.projectionMatrix),U.copy(L),M.x=U.x*G+G,M.y=U.y*E+E,u||0<M.x&&M.x<y&&0<M.y&&M.y<z){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,w);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,M.x-8,M.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,I.x,I.y);m.uniform3f(n,U.x,U.y,U.z);m.disable(m.BLEND);m.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,
|
|
|
-0);m.activeTexture(m.TEXTURE0);m.bindTexture(m.TEXTURE_2D,x);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,M.x-8,M.y-8,16,16,0);m.uniform1i(c,1);m.disable(m.DEPTH_TEST);m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,w);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);O.positionScreen.copy(U);O.customUpdateCallback?O.customUpdateCallback(O):O.updateLensFlares();m.uniform1i(c,2);m.enable(m.BLEND);for(var V=0,F=O.lensFlares.length;V<F;V++){var N=O.lensFlares[V];.001<N.opacity&&.001<N.scale&&(U.x=N.x,
|
|
|
-U.y=N.y,U.z=N.z,D=N.size*N.scale/z,I.x=D*C,I.y=D,m.uniform3f(n,U.x,U.y,U.z),m.uniform2f(h,I.x,I.y),m.uniform1f(k,N.rotation),m.uniform1f(f,N.opacity),m.uniform3f(g,N.color.r,N.color.g,N.color.b),a.setBlending(N.blending,N.blendEquation,N.blendSrc,N.blendDst),a.setTexture(N.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};
|
|
|
-THREE.ShadowMapPlugin=function(a,b,c,d){function e(a,b,d){if(b.visible){var f=c[b.id];if(f&&b.castShadow&&(!1===b.frustumCulled||!0===p.intersectsObject(b)))for(var g=0,h=f.length;g<h;g++){var k=f[g];b._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,b.matrixWorld);r.push(k)}g=0;for(h=b.children.length;g<h;g++)e(a,b.children[g],d)}}var f=a.context,g,h,k,n,p=new THREE.Frustum,q=new THREE.Matrix4,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,r=[],u=THREE.ShaderLib.depthRGBA,w=THREE.UniformsUtils.clone(u.uniforms);
|
|
|
-g=new THREE.ShaderMaterial({uniforms:w,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader});h=new THREE.ShaderMaterial({uniforms:w,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0});k=new THREE.ShaderMaterial({uniforms:w,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,skinning:!0});n=new THREE.ShaderMaterial({uniforms:w,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0,skinning:!0});g._shadowPass=!0;h._shadowPass=!0;k._shadowPass=
|
|
|
-!0;n._shadowPass=!0;this.render=function(c,w){if(!1!==a.shadowMapEnabled){var v,u,z,C,G,E,D,I,U=[];C=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.setDepthTest(!0);v=0;for(u=b.length;v<u;v++)if(z=b[v],z.castShadow)if(z instanceof THREE.DirectionalLight&&z.shadowCascade)for(G=0;G<z.shadowCascadeCount;G++){var M;if(z.shadowCascadeArray[G])M=z.shadowCascadeArray[G];else{D=z;var J=
|
|
|
-G;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=D.shadowCameraNear;M.shadowCameraFar=D.shadowCameraFar;M.shadowCameraLeft=D.shadowCameraLeft;M.shadowCameraRight=D.shadowCameraRight;M.shadowCameraBottom=D.shadowCameraBottom;M.shadowCameraTop=D.shadowCameraTop;M.shadowCameraVisible=D.shadowCameraVisible;M.shadowDarkness=D.shadowDarkness;M.shadowBias=D.shadowCascadeBias[J];M.shadowMapWidth=D.shadowCascadeWidth[J];M.shadowMapHeight=D.shadowCascadeHeight[J];
|
|
|
-M.pointsWorld=[];M.pointsFrustum=[];I=M.pointsWorld;E=M.pointsFrustum;for(var K=0;8>K;K++)I[K]=new THREE.Vector3,E[K]=new THREE.Vector3;I=D.shadowCascadeNearZ[J];D=D.shadowCascadeFarZ[J];E[0].set(-1,-1,I);E[1].set(1,-1,I);E[2].set(-1,1,I);E[3].set(1,1,I);E[4].set(-1,-1,D);E[5].set(1,-1,D);E[6].set(-1,1,D);E[7].set(1,1,D);M.originalCamera=w;E=new THREE.Gyroscope;E.position.copy(z.shadowCascadeOffset);E.add(M);E.add(M.target);w.add(E);z.shadowCascadeArray[G]=M;console.log("Created virtualLight",M)}J=
|
|
|
-z;I=G;D=J.shadowCascadeArray[I];D.position.copy(J.position);D.target.position.copy(J.target.position);D.lookAt(D.target);D.shadowCameraVisible=J.shadowCameraVisible;D.shadowDarkness=J.shadowDarkness;D.shadowBias=J.shadowCascadeBias[I];E=J.shadowCascadeNearZ[I];J=J.shadowCascadeFarZ[I];D=D.pointsFrustum;D[0].z=E;D[1].z=E;D[2].z=E;D[3].z=E;D[4].z=J;D[5].z=J;D[6].z=J;D[7].z=J;U[C]=M;C++}else U[C]=z,C++;v=0;for(u=U.length;v<u;v++){z=U[v];z.shadowMap||(G=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&
|
|
|
-(G=THREE.NearestFilter),z.shadowMap=new THREE.WebGLRenderTarget(z.shadowMapWidth,z.shadowMapHeight,{minFilter:G,magFilter:G,format:THREE.RGBAFormat}),z.shadowMapSize=new THREE.Vector2(z.shadowMapWidth,z.shadowMapHeight),z.shadowMatrix=new THREE.Matrix4);if(!z.shadowCamera){if(z instanceof THREE.SpotLight)z.shadowCamera=new THREE.PerspectiveCamera(z.shadowCameraFov,z.shadowMapWidth/z.shadowMapHeight,z.shadowCameraNear,z.shadowCameraFar);else if(z instanceof THREE.DirectionalLight)z.shadowCamera=new THREE.OrthographicCamera(z.shadowCameraLeft,
|
|
|
-z.shadowCameraRight,z.shadowCameraTop,z.shadowCameraBottom,z.shadowCameraNear,z.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}c.add(z.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}z.shadowCameraVisible&&!z.cameraHelper&&(z.cameraHelper=new THREE.CameraHelper(z.shadowCamera),c.add(z.cameraHelper));if(z.isVirtual&&M.originalCamera==w){G=w;C=z.shadowCamera;E=z.pointsFrustum;D=z.pointsWorld;m.set(Infinity,Infinity,Infinity);t.set(-Infinity,-Infinity,-Infinity);
|
|
|
-for(J=0;8>J;J++)I=D[J],I.copy(E[J]),I.unproject(G),I.applyMatrix4(C.matrixWorldInverse),I.x<m.x&&(m.x=I.x),I.x>t.x&&(t.x=I.x),I.y<m.y&&(m.y=I.y),I.y>t.y&&(t.y=I.y),I.z<m.z&&(m.z=I.z),I.z>t.z&&(t.z=I.z);C.left=m.x;C.right=t.x;C.top=t.y;C.bottom=m.y;C.updateProjectionMatrix()}C=z.shadowMap;E=z.shadowMatrix;G=z.shadowCamera;G.position.setFromMatrixPosition(z.matrixWorld);s.setFromMatrixPosition(z.target.matrixWorld);G.lookAt(s);G.updateMatrixWorld();G.matrixWorldInverse.getInverse(G.matrixWorld);z.cameraHelper&&
|
|
|
-(z.cameraHelper.visible=z.shadowCameraVisible);z.shadowCameraVisible&&z.cameraHelper.update();E.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);E.multiply(G.projectionMatrix);E.multiply(G.matrixWorldInverse);q.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(C);a.clear();r.length=0;e(c,c,G);z=0;for(C=r.length;z<C;z++)D=r[z],E=D.object,D=D.buffer,J=E.material instanceof THREE.MeshFaceMaterial?E.material.materials[0]:E.material,I=void 0!==E.geometry.morphTargets&&
|
|
|
-0<E.geometry.morphTargets.length&&J.morphTargets,K=E instanceof THREE.SkinnedMesh&&J.skinning,I=E.customDepthMaterial?E.customDepthMaterial:K?I?n:k:I?h:g,a.setMaterialFaces(J),D instanceof THREE.BufferGeometry?a.renderBufferDirect(G,b,null,I,D,E):a.renderBuffer(G,b,null,I,D,E);z=0;for(C=d.length;z<C;z++)D=d[z],E=D.object,E.visible&&E.castShadow&&(E._modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,E.matrixWorld),a.renderImmediateObject(G,b,null,g,E))}v=a.getClearColor();u=a.getClearAlpha();f.clearColor(v.r,
|
|
|
-v.g,v.b,u);f.enable(f.BLEND);a.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState()}}};
|
|
|
-THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,w,x;function L(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var v=a.context,y,z,C,G,E=new THREE.Vector3,D=new THREE.Quaternion,I=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===C){var J=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),K=new Uint16Array([0,1,2,0,2,3]);y=v.createBuffer();z=v.createBuffer();v.bindBuffer(v.ARRAY_BUFFER,y);v.bufferData(v.ARRAY_BUFFER,J,v.STATIC_DRAW);v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,
|
|
|
-z);v.bufferData(v.ELEMENT_ARRAY_BUFFER,K,v.STATIC_DRAW);var J=v.createProgram(),K=v.createShader(v.VERTEX_SHADER),O=v.createShader(v.FRAGMENT_SHADER);v.shaderSource(K,["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"));
|
|
|
-v.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;\nfloat fogFactor = 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"));
|
|
|
-v.compileShader(K);v.compileShader(O);v.attachShader(J,K);v.attachShader(J,O);v.linkProgram(J);C=J;w=v.getAttribLocation(C,"position");x=v.getAttribLocation(C,"uv");c=v.getUniformLocation(C,"uvOffset");d=v.getUniformLocation(C,"uvScale");e=v.getUniformLocation(C,"rotation");f=v.getUniformLocation(C,"scale");g=v.getUniformLocation(C,"color");h=v.getUniformLocation(C,"map");k=v.getUniformLocation(C,"opacity");n=v.getUniformLocation(C,"modelViewMatrix");p=v.getUniformLocation(C,"projectionMatrix");q=
|
|
|
-v.getUniformLocation(C,"fogType");m=v.getUniformLocation(C,"fogDensity");t=v.getUniformLocation(C,"fogNear");s=v.getUniformLocation(C,"fogFar");r=v.getUniformLocation(C,"fogColor");u=v.getUniformLocation(C,"alphaTest");J=document.createElement("canvas");J.width=8;J.height=8;K=J.getContext("2d");K.fillStyle="white";K.fillRect(0,0,8,8);G=new THREE.Texture(J);G.needsUpdate=!0}v.useProgram(C);v.enableVertexAttribArray(w);v.enableVertexAttribArray(x);v.disable(v.CULL_FACE);v.enable(v.BLEND);v.bindBuffer(v.ARRAY_BUFFER,
|
|
|
-y);v.vertexAttribPointer(w,2,v.FLOAT,!1,16,0);v.vertexAttribPointer(x,2,v.FLOAT,!1,16,8);v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,z);v.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);v.activeTexture(v.TEXTURE0);v.uniform1i(h,0);K=J=0;(O=U.fog)?(v.uniform3f(r,O.color.r,O.color.g,O.color.b),O instanceof THREE.Fog?(v.uniform1f(t,O.near),v.uniform1f(s,O.far),v.uniform1i(q,1),K=J=1):O instanceof THREE.FogExp2&&(v.uniform1f(m,O.density),v.uniform1i(q,2),K=J=2)):(v.uniform1i(q,0),K=J=0);for(var O=0,V=b.length;O<
|
|
|
-V;O++){var F=b[O];F._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,F.matrixWorld);F.z=null===F.renderDepth?-F._modelViewMatrix.elements[14]:F.renderDepth}b.sort(L);for(var N=[],O=0,V=b.length;O<V;O++){var F=b[O],R=F.material;v.uniform1f(u,R.alphaTest);v.uniformMatrix4fv(n,!1,F._modelViewMatrix.elements);F.matrixWorld.decompose(E,D,I);N[0]=I.x;N[1]=I.y;F=0;U.fog&&R.fog&&(F=K);J!==F&&(v.uniform1i(q,F),J=F);null!==R.map?(v.uniform2f(c,R.map.offset.x,R.map.offset.y),v.uniform2f(d,R.map.repeat.x,
|
|
|
-R.map.repeat.y)):(v.uniform2f(c,0,0),v.uniform2f(d,1,1));v.uniform1f(k,R.opacity);v.uniform3f(g,R.color.r,R.color.g,R.color.b);v.uniform1f(e,R.rotation);v.uniform2fv(f,N);a.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst);a.setDepthTest(R.depthTest);a.setDepthWrite(R.depthWrite);R.map&&R.map.image&&R.map.image.width?a.setTexture(R.map,0):a.setTexture(G,0);v.drawElements(v.TRIANGLES,6,v.UNSIGNED_SHORT,0)}v.enable(v.CULL_FACE);a.resetGLState()}}};
|
|
|
+I=m.createProgram(),K=m.createShader(m.FRAGMENT_SHADER),N=m.createShader(m.VERTEX_SHADER),T="precision "+a.getPrecision()+" float;\n";m.shaderSource(K,T+C.fragmentShader);m.shaderSource(N,T+C.vertexShader);m.compileShader(K);m.compileShader(N);m.attachShader(I,K);m.attachShader(I,N);m.linkProgram(I);r=I;p=m.getAttribLocation(r,"position");q=m.getAttribLocation(r,"uv");c=m.getUniformLocation(r,"renderType");d=m.getUniformLocation(r,"map");e=m.getUniformLocation(r,"occlusionMap");f=m.getUniformLocation(r,
|
|
|
+"opacity");g=m.getUniformLocation(r,"color");h=m.getUniformLocation(r,"scale");k=m.getUniformLocation(r,"rotation");n=m.getUniformLocation(r,"screenPosition")}m.useProgram(r);m.enableVertexAttribArray(p);m.enableVertexAttribArray(q);m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,t);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(q,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,s);m.disable(m.CULL_FACE);m.depthMask(!1);I=0;for(K=b.length;I<K;I++)if(C=16/z,A.set(C*
|
|
|
+F,C),N=b[I],L.set(N.matrixWorld.elements[12],N.matrixWorld.elements[13],N.matrixWorld.elements[14]),L.applyMatrix4(x.matrixWorldInverse),L.applyProjection(x.projectionMatrix),U.copy(L),M.x=U.x*D+D,M.y=U.y*w+w,u||0<M.x&&M.x<E&&0<M.y&&M.y<z){m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,M.x-8,M.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,A.x,A.y);m.uniform3f(n,U.x,U.y,U.z);m.disable(m.BLEND);m.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,
|
|
|
+0);m.activeTexture(m.TEXTURE0);m.bindTexture(m.TEXTURE_2D,y);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,M.x-8,M.y-8,16,16,0);m.uniform1i(c,1);m.disable(m.DEPTH_TEST);m.activeTexture(m.TEXTURE1);m.bindTexture(m.TEXTURE_2D,v);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);N.positionScreen.copy(U);N.customUpdateCallback?N.customUpdateCallback(N):N.updateLensFlares();m.uniform1i(c,2);m.enable(m.BLEND);for(var T=0,P=N.lensFlares.length;T<P;T++){var X=N.lensFlares[T];.001<X.opacity&&.001<X.scale&&(U.x=X.x,
|
|
|
+U.y=X.y,U.z=X.z,C=X.size*X.scale/z,A.x=C*F,A.y=C,m.uniform3f(n,U.x,U.y,U.z),m.uniform2f(h,A.x,A.y),m.uniform1f(k,X.rotation),m.uniform1f(f,X.opacity),m.uniform3f(g,X.color.r,X.color.g,X.color.b),a.setBlending(X.blending,X.blendEquation,X.blendSrc,X.blendDst),a.setTexture(X.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};
|
|
|
+THREE.ShadowMapPlugin=function(a,b,c,d){function e(a,b,d){if(b.visible){var f=c[b.id];if(f&&b.castShadow&&(!1===b.frustumCulled||!0===p.intersectsObject(b)))for(var g=0,h=f.length;g<h;g++){var k=f[g];b._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,b.matrixWorld);r.push(k)}g=0;for(h=b.children.length;g<h;g++)e(a,b.children[g],d)}}var f=a.context,g,h,k,n,p=new THREE.Frustum,q=new THREE.Matrix4,m=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,r=[],u=THREE.ShaderLib.depthRGBA,v=THREE.UniformsUtils.clone(u.uniforms);
|
|
|
+g=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader});h=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0});k=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,skinning:!0});n=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0,skinning:!0});g._shadowPass=!0;h._shadowPass=!0;k._shadowPass=
|
|
|
+!0;n._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,E,z,F,D,w,C,A,U=[];F=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.setDepthTest(!0);u=0;for(E=b.length;u<E;u++)if(z=b[u],z.castShadow)if(z instanceof THREE.DirectionalLight&&z.shadowCascade)for(D=0;D<z.shadowCascadeCount;D++){var M;if(z.shadowCascadeArray[D])M=z.shadowCascadeArray[D];else{C=z;var I=
|
|
|
+D;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=C.shadowCameraNear;M.shadowCameraFar=C.shadowCameraFar;M.shadowCameraLeft=C.shadowCameraLeft;M.shadowCameraRight=C.shadowCameraRight;M.shadowCameraBottom=C.shadowCameraBottom;M.shadowCameraTop=C.shadowCameraTop;M.shadowCameraVisible=C.shadowCameraVisible;M.shadowDarkness=C.shadowDarkness;M.shadowBias=C.shadowCascadeBias[I];M.shadowMapWidth=C.shadowCascadeWidth[I];M.shadowMapHeight=C.shadowCascadeHeight[I];
|
|
|
+M.pointsWorld=[];M.pointsFrustum=[];A=M.pointsWorld;w=M.pointsFrustum;for(var K=0;8>K;K++)A[K]=new THREE.Vector3,w[K]=new THREE.Vector3;A=C.shadowCascadeNearZ[I];C=C.shadowCascadeFarZ[I];w[0].set(-1,-1,A);w[1].set(1,-1,A);w[2].set(-1,1,A);w[3].set(1,1,A);w[4].set(-1,-1,C);w[5].set(1,-1,C);w[6].set(-1,1,C);w[7].set(1,1,C);M.originalCamera=v;w=new THREE.Gyroscope;w.position.copy(z.shadowCascadeOffset);w.add(M);w.add(M.target);v.add(w);z.shadowCascadeArray[D]=M;console.log("Created virtualLight",M)}I=
|
|
|
+z;A=D;C=I.shadowCascadeArray[A];C.position.copy(I.position);C.target.position.copy(I.target.position);C.lookAt(C.target);C.shadowCameraVisible=I.shadowCameraVisible;C.shadowDarkness=I.shadowDarkness;C.shadowBias=I.shadowCascadeBias[A];w=I.shadowCascadeNearZ[A];I=I.shadowCascadeFarZ[A];C=C.pointsFrustum;C[0].z=w;C[1].z=w;C[2].z=w;C[3].z=w;C[4].z=I;C[5].z=I;C[6].z=I;C[7].z=I;U[F]=M;F++}else U[F]=z,F++;u=0;for(E=U.length;u<E;u++){z=U[u];z.shadowMap||(D=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&
|
|
|
+(D=THREE.NearestFilter),z.shadowMap=new THREE.WebGLRenderTarget(z.shadowMapWidth,z.shadowMapHeight,{minFilter:D,magFilter:D,format:THREE.RGBAFormat}),z.shadowMapSize=new THREE.Vector2(z.shadowMapWidth,z.shadowMapHeight),z.shadowMatrix=new THREE.Matrix4);if(!z.shadowCamera){if(z instanceof THREE.SpotLight)z.shadowCamera=new THREE.PerspectiveCamera(z.shadowCameraFov,z.shadowMapWidth/z.shadowMapHeight,z.shadowCameraNear,z.shadowCameraFar);else if(z instanceof THREE.DirectionalLight)z.shadowCamera=new THREE.OrthographicCamera(z.shadowCameraLeft,
|
|
|
+z.shadowCameraRight,z.shadowCameraTop,z.shadowCameraBottom,z.shadowCameraNear,z.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}c.add(z.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}z.shadowCameraVisible&&!z.cameraHelper&&(z.cameraHelper=new THREE.CameraHelper(z.shadowCamera),c.add(z.cameraHelper));if(z.isVirtual&&M.originalCamera==v){D=v;F=z.shadowCamera;w=z.pointsFrustum;C=z.pointsWorld;m.set(Infinity,Infinity,Infinity);t.set(-Infinity,-Infinity,-Infinity);
|
|
|
+for(I=0;8>I;I++)A=C[I],A.copy(w[I]),A.unproject(D),A.applyMatrix4(F.matrixWorldInverse),A.x<m.x&&(m.x=A.x),A.x>t.x&&(t.x=A.x),A.y<m.y&&(m.y=A.y),A.y>t.y&&(t.y=A.y),A.z<m.z&&(m.z=A.z),A.z>t.z&&(t.z=A.z);F.left=m.x;F.right=t.x;F.top=t.y;F.bottom=m.y;F.updateProjectionMatrix()}F=z.shadowMap;w=z.shadowMatrix;D=z.shadowCamera;D.position.setFromMatrixPosition(z.matrixWorld);s.setFromMatrixPosition(z.target.matrixWorld);D.lookAt(s);D.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);z.cameraHelper&&
|
|
|
+(z.cameraHelper.visible=z.shadowCameraVisible);z.shadowCameraVisible&&z.cameraHelper.update();w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);w.multiply(D.projectionMatrix);w.multiply(D.matrixWorldInverse);q.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(F);a.clear();r.length=0;e(c,c,D);z=0;for(F=r.length;z<F;z++)C=r[z],w=C.object,C=C.buffer,I=w.material instanceof THREE.MeshFaceMaterial?w.material.materials[0]:w.material,A=void 0!==w.geometry.morphTargets&&
|
|
|
+0<w.geometry.morphTargets.length&&I.morphTargets,K=w instanceof THREE.SkinnedMesh&&I.skinning,A=w.customDepthMaterial?w.customDepthMaterial:K?A?n:k:A?h:g,a.setMaterialFaces(I),C instanceof THREE.BufferGeometry?a.renderBufferDirect(D,b,null,A,C,w):a.renderBuffer(D,b,null,A,C,w);z=0;for(F=d.length;z<F;z++)C=d[z],w=C.object,w.visible&&w.castShadow&&(w._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,w.matrixWorld),a.renderImmediateObject(D,b,null,g,w))}u=a.getClearColor();E=a.getClearAlpha();f.clearColor(u.r,
|
|
|
+u.g,u.b,E);f.enable(f.BLEND);a.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState()}}};
|
|
|
+THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,n,p,q,m,t,s,r,u,v,y;function L(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,E,z,F,D,w=new THREE.Vector3,C=new THREE.Quaternion,A=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===F){var I=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),K=new Uint16Array([0,1,2,0,2,3]);E=x.createBuffer();z=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,E);x.bufferData(x.ARRAY_BUFFER,I,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
|
|
|
+z);x.bufferData(x.ELEMENT_ARRAY_BUFFER,K,x.STATIC_DRAW);var I=x.createProgram(),K=x.createShader(x.VERTEX_SHADER),N=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(K,["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(N,["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;\nfloat fogFactor = 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(K);x.compileShader(N);x.attachShader(I,K);x.attachShader(I,N);x.linkProgram(I);F=I;v=x.getAttribLocation(F,"position");y=x.getAttribLocation(F,"uv");c=x.getUniformLocation(F,"uvOffset");d=x.getUniformLocation(F,"uvScale");e=x.getUniformLocation(F,"rotation");f=x.getUniformLocation(F,"scale");g=x.getUniformLocation(F,"color");h=x.getUniformLocation(F,"map");k=x.getUniformLocation(F,"opacity");n=x.getUniformLocation(F,"modelViewMatrix");p=x.getUniformLocation(F,"projectionMatrix");q=
|
|
|
+x.getUniformLocation(F,"fogType");m=x.getUniformLocation(F,"fogDensity");t=x.getUniformLocation(F,"fogNear");s=x.getUniformLocation(F,"fogFar");r=x.getUniformLocation(F,"fogColor");u=x.getUniformLocation(F,"alphaTest");I=document.createElement("canvas");I.width=8;I.height=8;K=I.getContext("2d");K.fillStyle="white";K.fillRect(0,0,8,8);D=new THREE.Texture(I);D.needsUpdate=!0}x.useProgram(F);x.enableVertexAttribArray(v);x.enableVertexAttribArray(y);x.disable(x.CULL_FACE);x.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,
|
|
|
+E);x.vertexAttribPointer(v,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(y,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);x.activeTexture(x.TEXTURE0);x.uniform1i(h,0);K=I=0;(N=U.fog)?(x.uniform3f(r,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(t,N.near),x.uniform1f(s,N.far),x.uniform1i(q,1),K=I=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(q,2),K=I=2)):(x.uniform1i(q,0),K=I=0);for(var N=0,T=b.length;N<
|
|
|
+T;N++){var P=b[N];P._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,P.matrixWorld);P.z=null===P.renderDepth?-P._modelViewMatrix.elements[14]:P.renderDepth}b.sort(L);for(var X=[],N=0,T=b.length;N<T;N++){var P=b[N],Q=P.material;x.uniform1f(u,Q.alphaTest);x.uniformMatrix4fv(n,!1,P._modelViewMatrix.elements);P.matrixWorld.decompose(w,C,A);X[0]=A.x;X[1]=A.y;P=0;U.fog&&Q.fog&&(P=K);I!==P&&(x.uniform1i(q,P),I=P);null!==Q.map?(x.uniform2f(c,Q.map.offset.x,Q.map.offset.y),x.uniform2f(d,Q.map.repeat.x,
|
|
|
+Q.map.repeat.y)):(x.uniform2f(c,0,0),x.uniform2f(d,1,1));x.uniform1f(k,Q.opacity);x.uniform3f(g,Q.color.r,Q.color.g,Q.color.b);x.uniform1f(e,Q.rotation);x.uniform2fv(f,X);a.setBlending(Q.blending,Q.blendEquation,Q.blendSrc,Q.blendDst);a.setDepthTest(Q.depthTest);a.setDepthWrite(Q.depthWrite);Q.map&&Q.map.image&&Q.map.image.width?a.setTexture(Q.map,0):a.setTexture(D,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}x.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 f=new THREE.Texture(void 0,b);e.load(a,function(a){f.image=a;f.needsUpdate=!0;c&&c(f)},void 0,function(a){d&&d(a)});f.sourceFile=a;return f},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b);f.flipY=!1;var g=0;b=function(b){e.load(a[b],function(a){f.images[b]=a;g+=1;6===g&&(f.needsUpdate=!0,c&&
|
|
|
c(f))})};d=0;for(var h=a.length;d<h;++d)b(d);return f},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,f=document.createElement("canvas");
|
|
|
-f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),n=k.data,p=0;p<d;p++)for(var q=0;q<e;q++){var m=0>q-1?0:q-1,t=q+1>e-1?e-1:q+1,s=0>p-1?0:p-1,r=p+1>d-1?d-1:p+1,u=[],w=[0,0,h[4*(q*d+p)]/255*b];u.push([-1,0,h[4*(q*d+s)]/255*b]);u.push([-1,-1,h[4*(m*d+s)]/255*b]);u.push([0,-1,h[4*(m*d+p)]/255*b]);u.push([1,-1,h[4*(m*d+r)]/255*b]);u.push([1,0,h[4*(q*d+r)]/255*b]);u.push([1,1,h[4*(t*d+r)]/255*b]);u.push([0,1,h[4*(t*d+p)]/255*
|
|
|
-b]);u.push([-1,1,h[4*(t*d+s)]/255*b]);m=[];s=u.length;for(t=0;t<s;t++){var r=u[t],x=u[(t+1)%s],r=[r[0]-w[0],r[1]-w[1],r[2]-w[2]],x=[x[0]-w[0],x[1]-w[1],x[2]-w[2]];m.push(c([r[1]*x[2]-r[2]*x[1],r[2]*x[0]-r[0]*x[2],r[0]*x[1]-r[1]*x[0]]))}u=[0,0,0];for(t=0;t<m.length;t++)u[0]+=m[t][0],u[1]+=m[t][1],u[2]+=m[t][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;w=4*(q*d+p);n[w]=(u[0]+1)/2*255|0;n[w+1]=(u[1]+1)/2*255|0;n[w+2]=255*u[2]|0;n[w+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,
|
|
|
+f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),n=k.data,p=0;p<d;p++)for(var q=0;q<e;q++){var m=0>q-1?0:q-1,t=q+1>e-1?e-1:q+1,s=0>p-1?0:p-1,r=p+1>d-1?d-1:p+1,u=[],v=[0,0,h[4*(q*d+p)]/255*b];u.push([-1,0,h[4*(q*d+s)]/255*b]);u.push([-1,-1,h[4*(m*d+s)]/255*b]);u.push([0,-1,h[4*(m*d+p)]/255*b]);u.push([1,-1,h[4*(m*d+r)]/255*b]);u.push([1,0,h[4*(q*d+r)]/255*b]);u.push([1,1,h[4*(t*d+r)]/255*b]);u.push([0,1,h[4*(t*d+p)]/255*
|
|
|
+b]);u.push([-1,1,h[4*(t*d+s)]/255*b]);m=[];s=u.length;for(t=0;t<s;t++){var r=u[t],y=u[(t+1)%s],r=[r[0]-v[0],r[1]-v[1],r[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];m.push(c([r[1]*y[2]-r[2]*y[1],r[2]*y[0]-r[0]*y[2],r[0]*y[1]-r[1]*y[0]]))}u=[0,0,0];for(t=0;t<m.length;t++)u[0]+=m[t][0],u[1]+=m[t][1],u[2]+=m[t][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;v=4*(q*d+p);n[v]=(u[0]+1)/2*255|0;n[v+1]=(u[1]+1)/2*255|0;n[v+2]=255*u[2]|0;n[v+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,
|
|
|
b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
|
|
|
THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][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(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,n,p,q,m,t,s,r,u,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),n=b.length,a=0;a<n;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;p=b[a++]*c;e.moveTo(k,p);
|
|
|
-break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d;p=b[a++]*c;t=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(t,s,k,p);if(g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,q,t,k);THREE.Shape.Utils.b2(x,m,s,p)}break;case "b":if(k=b[a++]*c+d,p=b[a++]*c,t=b[a++]*c+d,s=b[a++]*c,r=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(t,s,r,u,k,p),g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++)x=g/h,THREE.Shape.Utils.b3(x,q,t,r,k),THREE.Shape.Utils.b3(x,
|
|
|
-m,s,u,p)}return{offset:w.ha*c,path:e}}}};
|
|
|
+a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,n,p,q,m,t,s,r,u,v=b.glyphs[a]||b.glyphs["?"];if(v){if(v.o)for(b=v._cachedOutline||(v._cachedOutline=v.o.split(" ")),n=b.length,a=0;a<n;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;p=b[a++]*c;e.moveTo(k,p);
|
|
|
+break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d;p=b[a++]*c;t=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(t,s,k,p);if(g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++){var y=g/h;THREE.Shape.Utils.b2(y,q,t,k);THREE.Shape.Utils.b2(y,m,s,p)}break;case "b":if(k=b[a++]*c+d,p=b[a++]*c,t=b[a++]*c+d,s=b[a++]*c,r=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(t,s,r,u,k,p),g=f[f.length-1])for(q=g.x,m=g.y,g=1,h=this.divisions;g<=h;g++)y=g/h,THREE.Shape.Utils.b3(y,q,t,r,k),THREE.Shape.Utils.b3(y,
|
|
|
+m,s,u,p)}return{offset:v.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",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,n,p;if(0<b(a))for(n=0;n<e;n++)g[n]=n;else for(n=0;n<e;n++)g[n]=e-1-n;var q=2*e;for(n=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=n;e<=k&&(k=0);n=k+1;e<=n&&(n=0);p=n+1;e<=p&&(p=0);var m;a:{var t=m=void 0,s=void 0,r=void 0,u=void 0,w=void 0,x=void 0,L=void 0,v=void 0,
|
|
|
-t=a[g[k]].x,s=a[g[k]].y,r=a[g[n]].x,u=a[g[n]].y,w=a[g[p]].x,x=a[g[p]].y;if(1E-10>(r-t)*(x-s)-(u-s)*(w-t))m=!1;else{var y=void 0,z=void 0,C=void 0,G=void 0,E=void 0,D=void 0,I=void 0,U=void 0,M=void 0,J=void 0,M=U=I=v=L=void 0,y=w-r,z=x-u,C=t-w,G=s-x,E=r-t,D=u-s;for(m=0;m<e;m++)if(L=a[g[m]].x,v=a[g[m]].y,!(L===t&&v===s||L===r&&v===u||L===w&&v===x)&&(I=L-t,U=v-s,M=L-r,J=v-u,L-=w,v-=x,M=y*J-z*M,I=E*U-D*I,U=C*v-G*L,-1E-10<=M&&-1E-10<=U&&-1E-10<=I)){m=!1;break a}m=!0}}if(m){f.push([a[g[k]],a[g[n]],a[g[p]]]);
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,n,p;if(0<b(a))for(n=0;n<e;n++)g[n]=n;else for(n=0;n<e;n++)g[n]=e-1-n;var q=2*e;for(n=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=n;e<=k&&(k=0);n=k+1;e<=n&&(n=0);p=n+1;e<=p&&(p=0);var m;a:{var t=m=void 0,s=void 0,r=void 0,u=void 0,v=void 0,y=void 0,L=void 0,x=void 0,
|
|
|
+t=a[g[k]].x,s=a[g[k]].y,r=a[g[n]].x,u=a[g[n]].y,v=a[g[p]].x,y=a[g[p]].y;if(1E-10>(r-t)*(y-s)-(u-s)*(v-t))m=!1;else{var E=void 0,z=void 0,F=void 0,D=void 0,w=void 0,C=void 0,A=void 0,U=void 0,M=void 0,I=void 0,M=U=A=x=L=void 0,E=v-r,z=y-u,F=t-v,D=s-y,w=r-t,C=u-s;for(m=0;m<e;m++)if(L=a[g[m]].x,x=a[g[m]].y,!(L===t&&x===s||L===r&&x===u||L===v&&x===y)&&(A=L-t,U=x-s,M=L-r,I=x-u,L-=v,x-=y,M=E*I-z*M,A=w*U-C*A,U=F*x-D*L,-1E-10<=M&&-1E-10<=U&&-1E-10<=A)){m=!1;break a}m=!0}}if(m){f.push([a[g[k]],a[g[n]],a[g[p]]]);
|
|
|
h.push([g[k],g[n],g[p]]);k=n;for(p=n+1;p<e;k++,p++)g[k]=g[p];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;
|
|
|
THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain)};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.source.connect(b.panner);b.source.start(0)})};c.send();return this};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};
|
|
@@ -666,11 +666,11 @@ h=[];var p=[],q=[],m=0,t;p[m]=void 0;q[m]=[];var s,r;s=0;for(r=e.length;s<r;s++)
|
|
|
hole:n}),t?(t=!1,h[u].push(m)):s=!0);t&&h[g].push(m)}0<r.length&&(s||(q=h))}s=0;for(r=p.length;s<r;s++)for(h=p[s].s,k.push(h),g=q[s],e=0,f=g.length;e<f;e++)h.holes.push(g[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)};
|
|
|
THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,n=e.y-d.y,p=a.x-d.x,q=a.y-d.y,C=h*k-g*n,G=h*p-g*q;if(1E-10<Math.abs(C)){if(0<C){if(0>G||G>C)return[];k=n*p-k*q;if(0>k||k>C)return[]}else{if(0<G||G<C)return[];k=n*p-k*q;if(0<k||k<C)return[]}if(0==k)return!f||0!=G&&G!=C?[a]:[];if(k==C)return!f||0!=G&&G!=C?[b]:[];if(0==G)return[d];
|
|
|
-if(G==C)return[e];f=k/C;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=G||n*p!=k*q)return[];h=0==g&&0==h;k=0==k&&0==n;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,C=d.x,n=e,d=e.x):(b=e,C=e.x,n=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,C=d.y,n=e,d=e.y):(b=e,C=e.y,n=d,d=d.y));return k<=C?a<C?[]:a==C?f?[]:[b]:a<=d?[b,h]:[b,n]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
|
|
|
+THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,n=e.y-d.y,p=a.x-d.x,q=a.y-d.y,F=h*k-g*n,D=h*p-g*q;if(1E-10<Math.abs(F)){if(0<F){if(0>D||D>F)return[];k=n*p-k*q;if(0>k||k>F)return[]}else{if(0<D||D<F)return[];k=n*p-k*q;if(0<k||k<F)return[]}if(0==k)return!f||0!=D&&D!=F?[a]:[];if(k==F)return!f||0!=D&&D!=F?[b]:[];if(0==D)return[d];
|
|
|
+if(D==F)return[e];f=k/F;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=D||n*p!=k*q)return[];h=0==g&&0==h;k=0==k&&0==n;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,F=d.x,n=e,d=e.x):(b=e,F=e.x,n=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,F=d.y,n=e,d=e.y):(b=e,F=e.y,n=d,d=d.y));return k<=F?a<F?[]:a==F?f?[]:[b]:a<=d?[b,h]:[b,n]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
|
|
|
[g,n]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,k,n,p={};h=a.concat();f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)n=h[f].x+":"+h[f].y,void 0!==p[n]&&console.log("Duplicate point",n),p[n]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;
|
|
|
-d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<n.length;e++)for(f=b[n[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,n=[],p,q,z,C,G,E=[],D,I,U,M=0;for(p=b.length;M<p;M++)n.push(M);D=0;for(var J=2*n.length;0<n.length;){J--;if(0>J){console.log("Infinite Loop! Holes left:"+
|
|
|
-n.length+", Probably Hole outside Shape!");break}for(q=D;q<h.length;q++){z=h[q];p=-1;for(M=0;M<n.length;M++)if(C=n[M],G=z.x+":"+z.y+":"+C,void 0===E[G]){k=b[C];for(I=0;I<k.length;I++)if(C=k[I],c(q,I)&&!f(z,C)&&!g(z,C)){p=I;n.splice(M,1);D=h.slice(0,q+1);C=h.slice(q);I=k.slice(p);U=k.slice(0,p+1);h=D.concat(I).concat(U).concat(C);D=q;break}if(0<=p)break;E[G]=!0}if(0<=p)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k=q[f],h=0;3>h;h++)n=k[h].x+":"+k[h].y,
|
|
|
+d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<n.length;e++)for(f=b[n[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,n=[],p,q,z,F,D,w=[],C,A,U,M=0;for(p=b.length;M<p;M++)n.push(M);C=0;for(var I=2*n.length;0<n.length;){I--;if(0>I){console.log("Infinite Loop! Holes left:"+
|
|
|
+n.length+", Probably Hole outside Shape!");break}for(q=C;q<h.length;q++){z=h[q];p=-1;for(M=0;M<n.length;M++)if(F=n[M],D=z.x+":"+z.y+":"+F,void 0===w[D]){k=b[F];for(A=0;A<k.length;A++)if(F=k[A],c(q,A)&&!f(z,F)&&!g(z,F)){p=A;n.splice(M,1);C=h.slice(0,q+1);F=h.slice(q);A=k.slice(p);U=k.slice(0,p+1);h=C.concat(A).concat(U).concat(F);C=q;break}if(0<=p)break;w[D]=!0}if(0<=p)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k=q[f],h=0;3>h;h++)n=k[h].x+":"+k[h].y,
|
|
|
n=p[n],void 0!==n&&(k[h]=n);return q.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,
|
|
|
b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};
|
|
|
THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return b};
|
|
@@ -695,10 +695,10 @@ c.animationCache.animations[this.data.name].originalMatrix=c.matrix);for(var c=c
|
|
|
THREE.Animation.prototype.resetBlendWeights=function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a];void 0!==c.animationCache&&(c.animationCache.blending.positionWeight=0,c.animationCache.blending.quaternionWeight=0,c.animationCache.blending.scaleWeight=0)}};
|
|
|
THREE.Animation.prototype.update=function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,q,m,t,s,r;e=(a.length-1)*b;q=Math.floor(e);e-=q;c[0]=0===q?q:q-1;c[1]=q;c[2]=q>a.length-2?q:q+1;c[3]=q>a.length-3?q:q+2;q=a[c[0]];t=a[c[1]];s=a[c[2]];r=a[c[3]];c=e*e;m=e*c;d[0]=f(q[0],t[0],s[0],r[0],e,c,m);d[1]=f(q[1],t[1],s[1],r[1],e,c,m);d[2]=f(q[2],t[2],s[2],r[2],e,c,m);return d},f=function(a,b,c,d,e,f,m){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*m+
|
|
|
(-3*(b-c)-2*a-d)*f+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)if(this.loop)this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset();else{this.stop();return}f=0;for(var h=this.hierarchy.length;f<h;f++)for(var k=this.hierarchy[f],n=k.animationCache.animations[this.data.name],p=k.animationCache.blending,q=0;3>q;q++){var m=this.keyTypes[q],t=n.prevKey[m],s=n.nextKey[m];
|
|
|
-if(0<this.timeScale&&s.time<=this.currentTime||0>this.timeScale&&t.time>=this.currentTime){t=this.data.hierarchy[f].keys[0];for(s=this.getNextKeyWith(m,f,1);s.time<this.currentTime&&s.index>t.index;)t=s,s=this.getNextKeyWith(m,f,s.index+1);n.prevKey[m]=t;n.nextKey[m]=s}k.matrixAutoUpdate=!0;k.matrixWorldNeedsUpdate=!0;var r=(this.currentTime-t.time)/(s.time-t.time),u=t[m],w=s[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,t=this.weight/(this.weight+p.positionWeight),k.position.lerp(c,t),p.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,t.index-1).pos,a[1]=u,a[2]=w,a[3]=this.getNextKeyWith("pos",f,s.index+1).pos,r=.33*r+.33,s=e(a,r),t=this.weight/(this.weight+p.positionWeight),p.positionWeight+=this.weight,m=k.position,m.x+=(s[0]-
|
|
|
-m.x)*t,m.y+=(s[1]-m.y)*t,m.z+=(s[2]-m.z)*t,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===p.quaternionWeight?(k.quaternion.copy(d),p.quaternionWeight=this.weight):(t=this.weight/(this.weight+p.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,t),p.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,t=this.weight/(this.weight+p.scaleWeight),k.scale.lerp(c,t),p.scaleWeight+=this.weight)}return!0}}}();THREE.Animation.prototype.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]};
|
|
|
+if(0<this.timeScale&&s.time<=this.currentTime||0>this.timeScale&&t.time>=this.currentTime){t=this.data.hierarchy[f].keys[0];for(s=this.getNextKeyWith(m,f,1);s.time<this.currentTime&&s.index>t.index;)t=s,s=this.getNextKeyWith(m,f,s.index+1);n.prevKey[m]=t;n.nextKey[m]=s}k.matrixAutoUpdate=!0;k.matrixWorldNeedsUpdate=!0;var r=(this.currentTime-t.time)/(s.time-t.time),u=t[m],v=s[m];0>r&&(r=0);1<r&&(r=1);if("pos"===m)if(this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=u[0]+(v[0]-u[0])*r,c.y=
|
|
|
+u[1]+(v[1]-u[1])*r,c.z=u[2]+(v[2]-u[2])*r,t=this.weight/(this.weight+p.positionWeight),k.position.lerp(c,t),p.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,t.index-1).pos,a[1]=u,a[2]=v,a[3]=this.getNextKeyWith("pos",f,s.index+1).pos,r=.33*r+.33,s=e(a,r),t=this.weight/(this.weight+p.positionWeight),p.positionWeight+=this.weight,m=k.position,m.x+=(s[0]-
|
|
|
+m.x)*t,m.y+=(s[1]-m.y)*t,m.z+=(s[2]-m.z)*t,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,v,d,r),0===p.quaternionWeight?(k.quaternion.copy(d),p.quaternionWeight=this.weight):(t=this.weight/(this.weight+p.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,t),p.quaternionWeight+=this.weight)):"scl"===m&&(c.x=u[0]+
|
|
|
+(v[0]-u[0])*r,c.y=u[1]+(v[1]-u[1])*r,c.z=u[2]+(v[2]-u[2])*r,t=this.weight/(this.weight+p.scaleWeight),k.scale.lerp(c,t),p.scaleWeight+=this.weight)}return!0}}}();THREE.Animation.prototype.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]};
|
|
|
THREE.Animation.prototype.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 f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
@@ -709,27 +709,27 @@ f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime):f.inter
|
|
|
THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};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);a=this.duration/this.frames;var b=Math.floor(this.currentTime/a);b!=this.currentFrame&&(this.mesh.morphTargetInfluences[this.lastFrame]=0,this.mesh.morphTargetInfluences[this.currentFrame]=
|
|
|
1,this.mesh.morphTargetInfluences[b]=0,this.lastFrame=this.currentFrame,this.currentFrame=b);this.mesh.morphTargetInfluences[b]=this.currentTime%a/a;this.mesh.morphTargetInfluences[this.lastFrame]=1-this.mesh.morphTargetInfluences[b]}}};
|
|
|
-THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var u,w=h.widthSegments,x=h.heightSegments,L=e/2,v=f/2,y=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",x=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",w=h.depthSegments;var z=w+1,C=x+1,G=e/w,E=f/x,D=new THREE.Vector3;D[u]=0<g?1:-1;for(e=0;e<C;e++)for(f=0;f<z;f++){var I=new THREE.Vector3;I[a]=(f*G-L)*c;I[b]=(e*E-v)*d;I[u]=g;h.vertices.push(I)}for(e=
|
|
|
-0;e<x;e++)for(f=0;f<w;f++)v=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/w,1-e/x),g=new THREE.Vector2(f/w,1-(e+1)/x),u=new THREE.Vector2((f+1)/w,1-(e+1)/x),L=new THREE.Vector2((f+1)/w,1-e/x),v=new THREE.Face3(v+y,a+y,c+y),v.normal.copy(D),v.vertexNormals.push(D.clone(),D.clone(),D.clone()),v.materialIndex=r,h.faces.push(v),h.faceVertexUvs[0].push([d,g,L]),v=new THREE.Face3(a+y,b+y,c+y),v.normal.copy(D),v.vertexNormals.push(D.clone(),D.clone(),D.clone()),v.materialIndex=r,h.faces.push(v),
|
|
|
+THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var u,v=h.widthSegments,y=h.heightSegments,L=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",y=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",v=h.depthSegments;var z=v+1,F=y+1,D=e/v,w=f/y,C=new THREE.Vector3;C[u]=0<g?1:-1;for(e=0;e<F;e++)for(f=0;f<z;f++){var A=new THREE.Vector3;A[a]=(f*D-L)*c;A[b]=(e*w-x)*d;A[u]=g;h.vertices.push(A)}for(e=
|
|
|
+0;e<y;e++)for(f=0;f<v;f++)x=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/v,1-e/y),g=new THREE.Vector2(f/v,1-(e+1)/y),u=new THREE.Vector2((f+1)/v,1-(e+1)/y),L=new THREE.Vector2((f+1)/v,1-e/y),x=new THREE.Face3(x+E,a+E,c+E),x.normal.copy(C),x.vertexNormals.push(C.clone(),C.clone(),C.clone()),x.materialIndex=r,h.faces.push(x),h.faceVertexUvs[0].push([d,g,L]),x=new THREE.Face3(a+E,b+E,c+E),x.normal.copy(C),x.vertexNormals.push(C.clone(),C.clone(),C.clone()),x.materialIndex=r,h.faces.push(x),
|
|
|
h.faceVertexUvs[0].push([g.clone(),u,L.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.BoxGeometry.prototype.constructor=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,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(.5,.5);this.vertices.push(e);f.push(g);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);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,
|
|
|
0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),g.clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry;
|
|
|
THREE.CubeGeometry=function(a,b,c,d,e,f){console.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new THREE.BoxGeometry(a,b,c,d,e,f)};
|
|
|
THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;var g=c/2,h,k,n=[],p=[];for(k=0;k<=e;k++){var q=[],m=[],t=k/e,s=t*(b-a)+a;for(h=0;h<=d;h++){var r=h/d,u=new THREE.Vector3;u.x=s*Math.sin(r*Math.PI*2);u.y=-t*c+g;u.z=s*Math.cos(r*Math.PI*2);this.vertices.push(u);q.push(this.vertices.length-
|
|
|
-1);m.push(new THREE.Vector2(r,1-t))}n.push(q);p.push(m)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[n[0][h]].clone(),m=this.vertices[n[0][h+1]].clone()):(q=this.vertices[n[1][h]].clone(),m=this.vertices[n[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize(),k=0;k<e;k++){var t=n[k][h],s=n[k+1][h],r=n[k+1][h+1],u=n[k][h+1],w=q.clone(),x=q.clone(),L=m.clone(),v=m.clone(),y=p[k][h].clone(),z=p[k+1][h].clone(),C=p[k+1][h+1].clone(),
|
|
|
-G=p[k][h+1].clone();this.faces.push(new THREE.Face3(t,s,u,[w,x,v]));this.faceVertexUvs[0].push([y,z,G]);this.faces.push(new THREE.Face3(s,r,u,[x.clone(),L,v.clone()]));this.faceVertexUvs[0].push([z.clone(),C,G.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)t=n[0][h],s=n[0][h+1],r=this.vertices.length-1,w=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),L=new THREE.Vector3(0,1,0),y=p[0][h].clone(),z=p[0][h+1].clone(),C=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(t,
|
|
|
-s,r,[w,x,L])),this.faceVertexUvs[0].push([y,z,C]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)t=n[k][h+1],s=n[k][h],r=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),L=new THREE.Vector3(0,-1,0),y=p[k][h+1].clone(),z=p[k][h].clone(),C=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(t,s,r,[w,x,L])),this.faceVertexUvs[0].push([y,z,C]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+1);m.push(new THREE.Vector2(r,1-t))}n.push(q);p.push(m)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[n[0][h]].clone(),m=this.vertices[n[0][h+1]].clone()):(q=this.vertices[n[1][h]].clone(),m=this.vertices[n[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize(),k=0;k<e;k++){var t=n[k][h],s=n[k+1][h],r=n[k+1][h+1],u=n[k][h+1],v=q.clone(),y=q.clone(),L=m.clone(),x=m.clone(),E=p[k][h].clone(),z=p[k+1][h].clone(),F=p[k+1][h+1].clone(),
|
|
|
+D=p[k][h+1].clone();this.faces.push(new THREE.Face3(t,s,u,[v,y,x]));this.faceVertexUvs[0].push([E,z,D]);this.faces.push(new THREE.Face3(s,r,u,[y.clone(),L,x.clone()]));this.faceVertexUvs[0].push([z.clone(),F,D.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)t=n[0][h],s=n[0][h+1],r=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),L=new THREE.Vector3(0,1,0),E=p[0][h].clone(),z=p[0][h+1].clone(),F=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(t,
|
|
|
+s,r,[v,y,L])),this.faceVertexUvs[0].push([E,z,F]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)t=n[k][h+1],s=n[k][h],r=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),L=new THREE.Vector3(0,-1,0),E=p[k][h+1].clone(),z=p[k][h].clone(),F=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(t,s,r,[v,y,L])),this.faceVertexUvs[0].push([E,z,F]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?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.log("die");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),m=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/m-h)*g-(c.y+f/m-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(Q=a.length;0<=--Q;){c=Q;d=Q-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=pa*e,h=pa*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+U,g=g+U,m=m+U,h=h+U;I.faces.push(new THREE.Face3(k,g,h,null,null,x));I.faces.push(new THREE.Face3(g,m,h,null,null,x));k=L.generateSideWallUV(I,k,g,m,h);I.faceVertexUvs[0].push([k[0],k[1],k[3]]);I.faceVertexUvs[0].push([k[1],
|
|
|
-k[2],k[3]])}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;I.faces.push(new THREE.Face3(a,b,c,null,null,w));a=L.generateTopUV(I,a,b,c);I.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,n=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,
|
|
|
-r,u=!1,w=b.material,x=b.extrudeMaterial,L=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,y,z,C;s&&(r=s.getSpacedPoints(t),u=!0,q=!1,v=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,!1),y=new THREE.Vector3,z=new THREE.Vector3,C=new THREE.Vector3);q||(n=k=p=0);var G,E,D,I=this,U=this.vertices.length,s=a.extractPoints(m),m=s.shape,M=s.holes;if(s=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();E=0;for(D=M.length;E<D;E++)G=M[E],THREE.Shape.Utils.isClockWise(G)&&
|
|
|
-(M[E]=G.reverse());s=!1}var J=THREE.Shape.Utils.triangulateShape(m,M),K=m;E=0;for(D=M.length;E<D;E++)G=M[E],m=m.concat(G);var O,V,F,N,R,pa=m.length,ba,ta=J.length,s=[],Q=0;F=K.length;O=F-1;for(V=Q+1;Q<F;Q++,O++,V++)O===F&&(O=0),V===F&&(V=0),s[Q]=d(K[Q],K[O],K[V]);var La=[],qa,Ga=s.concat();E=0;for(D=M.length;E<D;E++){G=M[E];qa=[];Q=0;F=G.length;O=F-1;for(V=Q+1;Q<F;Q++,O++,V++)O===F&&(O=0),V===F&&(V=0),qa[Q]=d(G[Q],G[O],G[V]);La.push(qa);Ga=Ga.concat(qa)}for(O=0;O<p;O++){F=O/p;N=k*(1-F);V=n*Math.sin(F*
|
|
|
-Math.PI/2);Q=0;for(F=K.length;Q<F;Q++)R=c(K[Q],s[Q],V),f(R.x,R.y,-N);E=0;for(D=M.length;E<D;E++)for(G=M[E],qa=La[E],Q=0,F=G.length;Q<F;Q++)R=c(G[Q],qa[Q],V),f(R.x,R.y,-N)}V=n;for(Q=0;Q<pa;Q++)R=q?c(m[Q],Ga[Q],V):m[Q],u?(z.copy(v.normals[0]).multiplyScalar(R.x),y.copy(v.binormals[0]).multiplyScalar(R.y),C.copy(r[0]).add(z).add(y),f(C.x,C.y,C.z)):f(R.x,R.y,0);for(F=1;F<=t;F++)for(Q=0;Q<pa;Q++)R=q?c(m[Q],Ga[Q],V):m[Q],u?(z.copy(v.normals[F]).multiplyScalar(R.x),y.copy(v.binormals[F]).multiplyScalar(R.y),
|
|
|
-C.copy(r[F]).add(z).add(y),f(C.x,C.y,C.z)):f(R.x,R.y,h/t*F);for(O=p-1;0<=O;O--){F=O/p;N=k*(1-F);V=n*Math.sin(F*Math.PI/2);Q=0;for(F=K.length;Q<F;Q++)R=c(K[Q],s[Q],V),f(R.x,R.y,h+N);E=0;for(D=M.length;E<D;E++)for(G=M[E],qa=La[E],Q=0,F=G.length;Q<F;Q++)R=c(G[Q],qa[Q],V),u?f(R.x,R.y+r[t-1].y,r[t-1].x+N):f(R.x,R.y,h+N)}(function(){if(q){var a;a=0*pa;for(Q=0;Q<ta;Q++)ba=J[Q],g(ba[2]+a,ba[1]+a,ba[0]+a);a=t+2*p;a*=pa;for(Q=0;Q<ta;Q++)ba=J[Q],g(ba[0]+a,ba[1]+a,ba[2]+a)}else{for(Q=0;Q<ta;Q++)ba=J[Q],g(ba[2],
|
|
|
-ba[1],ba[0]);for(Q=0;Q<ta;Q++)ba=J[Q],g(ba[0]+pa*t,ba[1]+pa*t,ba[2]+pa*t)}})();(function(){var a=0;e(K,a);a+=K.length;E=0;for(D=M.length;E<D;E++)G=M[E],e(G,a),a+=G.length})()};
|
|
|
+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(G=a.length;0<=--G;){c=G;d=G-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=pa*e,h=pa*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+U,g=g+U,m=m+U,h=h+U;A.faces.push(new THREE.Face3(k,g,h,null,null,y));A.faces.push(new THREE.Face3(g,m,h,null,null,y));k=L.generateSideWallUV(A,k,g,m,h);A.faceVertexUvs[0].push([k[0],k[1],k[3]]);A.faceVertexUvs[0].push([k[1],
|
|
|
+k[2],k[3]])}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;A.faces.push(new THREE.Face3(a,b,c,null,null,v));a=L.generateTopUV(A,a,b,c);A.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,n=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,
|
|
|
+r,u=!1,v=b.material,y=b.extrudeMaterial,L=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,E,z,F;s&&(r=s.getSpacedPoints(t),u=!0,q=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,!1),E=new THREE.Vector3,z=new THREE.Vector3,F=new THREE.Vector3);q||(n=k=p=0);var D,w,C,A=this,U=this.vertices.length,s=a.extractPoints(m),m=s.shape,M=s.holes;if(s=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();w=0;for(C=M.length;w<C;w++)D=M[w],THREE.Shape.Utils.isClockWise(D)&&
|
|
|
+(M[w]=D.reverse());s=!1}var I=THREE.Shape.Utils.triangulateShape(m,M),K=m;w=0;for(C=M.length;w<C;w++)D=M[w],m=m.concat(D);var N,T,P,X,Q,pa=m.length,ca,Ba=I.length,s=[],G=0;P=K.length;N=P-1;for(T=G+1;G<P;G++,N++,T++)N===P&&(N=0),T===P&&(T=0),s[G]=d(K[G],K[N],K[T]);var wa=[],qa,La=s.concat();w=0;for(C=M.length;w<C;w++){D=M[w];qa=[];G=0;P=D.length;N=P-1;for(T=G+1;G<P;G++,N++,T++)N===P&&(N=0),T===P&&(T=0),qa[G]=d(D[G],D[N],D[T]);wa.push(qa);La=La.concat(qa)}for(N=0;N<p;N++){P=N/p;X=k*(1-P);T=n*Math.sin(P*
|
|
|
+Math.PI/2);G=0;for(P=K.length;G<P;G++)Q=c(K[G],s[G],T),f(Q.x,Q.y,-X);w=0;for(C=M.length;w<C;w++)for(D=M[w],qa=wa[w],G=0,P=D.length;G<P;G++)Q=c(D[G],qa[G],T),f(Q.x,Q.y,-X)}T=n;for(G=0;G<pa;G++)Q=q?c(m[G],La[G],T):m[G],u?(z.copy(x.normals[0]).multiplyScalar(Q.x),E.copy(x.binormals[0]).multiplyScalar(Q.y),F.copy(r[0]).add(z).add(E),f(F.x,F.y,F.z)):f(Q.x,Q.y,0);for(P=1;P<=t;P++)for(G=0;G<pa;G++)Q=q?c(m[G],La[G],T):m[G],u?(z.copy(x.normals[P]).multiplyScalar(Q.x),E.copy(x.binormals[P]).multiplyScalar(Q.y),
|
|
|
+F.copy(r[P]).add(z).add(E),f(F.x,F.y,F.z)):f(Q.x,Q.y,h/t*P);for(N=p-1;0<=N;N--){P=N/p;X=k*(1-P);T=n*Math.sin(P*Math.PI/2);G=0;for(P=K.length;G<P;G++)Q=c(K[G],s[G],T),f(Q.x,Q.y,h+X);w=0;for(C=M.length;w<C;w++)for(D=M[w],qa=wa[w],G=0,P=D.length;G<P;G++)Q=c(D[G],qa[G],T),u?f(Q.x,Q.y+r[t-1].y,r[t-1].x+X):f(Q.x,Q.y,h+X)}(function(){if(q){var a;a=0*pa;for(G=0;G<Ba;G++)ca=I[G],g(ca[2]+a,ca[1]+a,ca[0]+a);a=t+2*p;a*=pa;for(G=0;G<Ba;G++)ca=I[G],g(ca[0]+a,ca[1]+a,ca[2]+a)}else{for(G=0;G<Ba;G++)ca=I[G],g(ca[2],
|
|
|
+ca[1],ca[0]);for(G=0;G<Ba;G++)ca=I[G],g(ca[0]+pa*t,ca[1]+pa*t,ca[2]+pa*t)}})();(function(){var a=0;e(K,a);a+=K.length;w=0;for(C=M.length;w<C;w++)D=M[w],e(D,a),a+=D.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,
|
|
|
1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===a instanceof Array&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
|
THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,n=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=n.length;e<f;e++)g=n[e],THREE.Shape.Utils.isClockWise(g)&&(n[e]=g.reverse());var p=THREE.Shape.Utils.triangulateShape(k,n);e=0;for(f=n.length;e<f;e++)g=n[e],
|
|
@@ -743,19 +743,19 @@ THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="Ri
|
|
|
(p.y/b+1)/2))}k+=n}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*(c+1),g=0;g<c;g++)f=q=g+e,n=q+c+1,p=q+c+2,this.faces.push(new THREE.Face3(f,n,p,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[n].clone(),h[p].clone()]),f=q,n=q+c+2,p=q+1,this.faces.push(new THREE.Face3(f,n,p,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[n].clone(),h[p].clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)};
|
|
|
THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry;
|
|
|
THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};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;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;var h,k,n=[],p=[];for(k=0;k<=c;k++){var q=[],m=[];for(h=0;h<=b;h++){var t=h/b,s=k/c,r=new THREE.Vector3;r.x=-a*Math.cos(d+t*e)*Math.sin(f+s*g);
|
|
|
-r.y=a*Math.cos(f+s*g);r.z=a*Math.sin(d+t*e)*Math.sin(f+s*g);this.vertices.push(r);q.push(this.vertices.length-1);m.push(new THREE.Vector2(t,1-s))}n.push(q);p.push(m)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=n[k][h+1];e=n[k][h];f=n[k+1][h];g=n[k+1][h+1];var q=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),t=this.vertices[f].clone().normalize(),s=this.vertices[g].clone().normalize(),r=p[k][h+1].clone(),u=p[k][h].clone(),w=p[k+1][h].clone(),x=p[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,f,g,[q,t,s])),this.faceVertexUvs[0].push([r,w,x])):Math.abs(this.vertices[f].y)===a?(w.x=(w.x+x.x)/2,this.faces.push(new THREE.Face3(d,e,f,[q,m,t])),this.faceVertexUvs[0].push([r,u,w])):(this.faces.push(new THREE.Face3(d,e,g,[q,m,s])),this.faceVertexUvs[0].push([r,u,x]),this.faces.push(new THREE.Face3(e,f,g,[m.clone(),t,s.clone()])),this.faceVertexUvs[0].push([u.clone(),w,x.clone()]))}this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,
|
|
|
+r.y=a*Math.cos(f+s*g);r.z=a*Math.sin(d+t*e)*Math.sin(f+s*g);this.vertices.push(r);q.push(this.vertices.length-1);m.push(new THREE.Vector2(t,1-s))}n.push(q);p.push(m)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=n[k][h+1];e=n[k][h];f=n[k+1][h];g=n[k+1][h+1];var q=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),t=this.vertices[f].clone().normalize(),s=this.vertices[g].clone().normalize(),r=p[k][h+1].clone(),u=p[k][h].clone(),v=p[k+1][h].clone(),y=p[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,f,g,[q,t,s])),this.faceVertexUvs[0].push([r,v,y])):Math.abs(this.vertices[f].y)===a?(v.x=(v.x+y.x)/2,this.faces.push(new THREE.Face3(d,e,f,[q,m,t])),this.faceVertexUvs[0].push([r,u,v])):(this.faces.push(new THREE.Face3(d,e,g,[q,m,s])),this.faceVertexUvs[0].push([r,u,y]),this.faces.push(new THREE.Face3(e,f,g,[m.clone(),t,s.clone()])),this.faceVertexUvs[0].push([u.clone(),v,y.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.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;
|
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=c||8;d=d||6;e=e||2*Math.PI;for(var f=new THREE.Vector3,g=[],h=[],k=0;k<=c;k++)for(var n=0;n<=d;n++){var p=n/d*e,q=k/c*Math.PI*2;f.x=a*Math.cos(p);f.y=a*Math.sin(p);var m=new THREE.Vector3;m.x=(a+b*Math.cos(q))*Math.cos(p);m.y=(a+b*Math.cos(q))*Math.sin(p);m.z=b*Math.sin(q);this.vertices.push(m);g.push(new THREE.Vector2(n/
|
|
|
d,k/c));h.push(m.clone().sub(f).normalize())}for(k=1;k<=c;k++)for(n=1;n<=d;n++)a=(d+1)*k+n-1,b=(d+1)*(k-1)+n-1,e=(d+1)*(k-1)+n,f=(d+1)*k+n,p=new THREE.Face3(a,b,f,[h[a].clone(),h[b].clone(),h[f].clone()]),this.faces.push(p),this.faceVertexUvs[0].push([g[a].clone(),g[b].clone(),g[f].clone()]),p=new THREE.Face3(b,e,f,[h[b].clone(),h[e].clone(),h[f].clone()]),this.faces.push(p),this.faceVertexUvs[0].push([g[b].clone(),g[e].clone(),g[f].clone()]);this.computeFaceNormals()};
|
|
|
THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){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:f,heightScale:g};a=a||100;b=b||40;c=c||64;d=d||8;e=e||2;f=f||3;g=g||1;for(var k=Array(c),n=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,m=0;m<c;++m){k[m]=
|
|
|
-Array(d);var t=m/c*2*e*Math.PI,s=h(t,f,e,a,g),t=h(t+.01,f,e,a,g);n.subVectors(t,s);p.addVectors(t,s);q.crossVectors(n,p);p.crossVectors(q,n);q.normalize();p.normalize();for(t=0;t<d;++t){var r=t/d*2*Math.PI,u=-b*Math.cos(r),r=b*Math.sin(r),w=new THREE.Vector3;w.x=s.x+u*p.x+r*q.x;w.y=s.y+u*p.y+r*q.y;w.z=s.z+u*p.z+r*q.z;k[m][t]=this.vertices.push(w)-1}}for(m=0;m<c;++m)for(t=0;t<d;++t)e=(m+1)%c,f=(t+1)%d,a=k[m][t],b=k[e][t],e=k[e][f],f=k[m][f],g=new THREE.Vector2(m/c,t/d),n=new THREE.Vector2((m+1)/c,
|
|
|
+Array(d);var t=m/c*2*e*Math.PI,s=h(t,f,e,a,g),t=h(t+.01,f,e,a,g);n.subVectors(t,s);p.addVectors(t,s);q.crossVectors(n,p);p.crossVectors(q,n);q.normalize();p.normalize();for(t=0;t<d;++t){var r=t/d*2*Math.PI,u=-b*Math.cos(r),r=b*Math.sin(r),v=new THREE.Vector3;v.x=s.x+u*p.x+r*q.x;v.y=s.y+u*p.y+r*q.y;v.z=s.z+u*p.z+r*q.z;k[m][t]=this.vertices.push(v)-1}}for(m=0;m<c;++m)for(t=0;t<d;++t)e=(m+1)%c,f=(t+1)%d,a=k[m][t],b=k[e][t],e=k[e][f],f=k[m][f],g=new THREE.Vector2(m/c,t/d),n=new THREE.Vector2((m+1)/c,
|
|
|
t/d),p=new THREE.Vector2((m+1)/c,(t+1)/d),q=new THREE.Vector2(m/c,(t+1)/d),this.faces.push(new THREE.Face3(a,b,f)),this.faceVertexUvs[0].push([g,n,q]),this.faces.push(new THREE.Face3(b,e,f)),this.faceVertexUvs[0].push([n.clone(),p,q.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,e){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;var f=[],g,h,k=b+1,n,p,q,m,t=new THREE.Vector3,s,r,u;s=new THREE.TubeGeometry.FrenetFrames(a,b,e);r=s.normals;u=s.binormals;this.tangents=s.tangents;this.normals=r;this.binormals=u;for(s=0;s<k;s++)for(f[s]=[],n=s/(k-1),m=a.getPointAt(n),g=r[s],h=u[s],n=0;n<d;n++)p=n/d*2*Math.PI,q=-c*Math.cos(p),p=c*Math.sin(p),
|
|
|
-t.copy(m),t.x+=q*g.x+p*h.x,t.y+=q*g.y+p*h.y,t.z+=q*g.z+p*h.z,f[s][n]=this.vertices.push(new THREE.Vector3(t.x,t.y,t.z))-1;for(s=0;s<b;s++)for(n=0;n<d;n++)k=e?(s+1)%b:s+1,t=(n+1)%d,a=f[s][n],c=f[k][n],k=f[k][t],t=f[s][t],r=new THREE.Vector2(s/b,n/d),u=new THREE.Vector2((s+1)/b,n/d),g=new THREE.Vector2((s+1)/b,(n+1)/d),h=new THREE.Vector2(s/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,t)),this.faceVertexUvs[0].push([r,u,h]),this.faces.push(new THREE.Face3(c,k,t)),this.faceVertexUvs[0].push([u.clone(),
|
|
|
-g,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,e,f){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;f=f||THREE.TubeGeometry.NoTaper;var g=[],h,k,n=b+1,p,q,m,t,s,r=new THREE.Vector3,u,v,y;u=new THREE.TubeGeometry.FrenetFrames(a,b,e);v=u.normals;y=u.binormals;this.tangents=u.tangents;this.normals=v;this.binormals=y;for(u=0;u<n;u++)for(g[u]=[],p=u/(n-1),s=a.getPointAt(p),h=v[u],k=y[u],m=c*f(p),p=0;p<d;p++)q=
|
|
|
+p/d*2*Math.PI,t=-m*Math.cos(q),q=m*Math.sin(q),r.copy(s),r.x+=t*h.x+q*k.x,r.y+=t*h.y+q*k.y,r.z+=t*h.z+q*k.z,g[u][p]=this.vertices.push(new THREE.Vector3(r.x,r.y,r.z))-1;for(u=0;u<b;u++)for(p=0;p<d;p++)f=e?(u+1)%b:u+1,n=(p+1)%d,a=g[u][p],c=g[f][p],f=g[f][n],n=g[u][n],r=new THREE.Vector2(u/b,p/d),v=new THREE.Vector2((u+1)/b,p/d),y=new THREE.Vector2((u+1)/b,(p+1)/d),h=new THREE.Vector2(u/b,(p+1)/d),this.faces.push(new THREE.Face3(a,c,n)),this.faceVertexUvs[0].push([r,v,h]),this.faces.push(new THREE.Face3(c,
|
|
|
+f,n)),this.faceVertexUvs[0].push([v.clone(),y,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 a};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var n,p,q;this.tangents=e;this.normals=f;this.binormals=g;for(n=0;n<b;n++)p=n/(b-1),e[n]=a.getTangentAt(p),e[n].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;n=Math.abs(e[0].x);p=Math.abs(e[0].y);q=Math.abs(e[0].z);n<=a&&(a=n,d.set(1,0,0));p<=a&&(a=p,d.set(0,1,0));q<=a&&d.set(0,0,1);h.crossVectors(e[0],
|
|
|
d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(n=1;n<b;n++)f[n]=f[n-1].clone(),g[n]=g[n-1].clone(),h.crossVectors(e[n-1],e[n]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[n-1].dot(e[n]),-1,1)),f[n].applyMatrix4(k.makeRotationAxis(h,d))),g[n].crossVectors(e[n],f[n]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),n=1;n<b;n++)f[n].applyMatrix4(k.makeRotationAxis(e[n],d*n)),g[n].crossVectors(e[n],
|
|
|
f[n])};
|
|
@@ -815,7 +815,7 @@ THREE.VertexTangentsHelper.prototype.constructor=THREE.VertexTangentsHelper;
|
|
|
THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,n=f.length;k<n;k++)for(var p=f[k],q=0,m=p.vertexTangents.length;q<m;q++){var t=p.vertexTangents[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b);
|
|
|
h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();
|
|
|
THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,n=a.geometry.faces,p=0,q=new Uint32Array(6*n.length),m=0,t=n.length;m<t;m++)for(var s=n[m],r=0;3>r;r++){d[0]=s[g[r]];d[1]=s[g[(r+1)%3]];d.sort(f);var u=d.toString();void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++)}d=new Float32Array(6*p);m=0;for(t=p;m<t;m++)for(r=0;2>r;r++)p=
|
|
|
-k[q[2*m+r]],g=6*m+3*r,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){k=a.geometry.attributes.position.array;t=a.geometry.attributes.index.array;n=a.geometry.drawcalls;p=0;0===n.length&&(n=[{count:t.length,index:0,start:0}]);for(var q=new Uint32Array(2*t.length),s=0,w=n.length;s<w;++s)for(var r=n[s].start,u=n[s].count,g=n[s].index,m=r,x=r+u;m<x;m+=3)for(r=0;3>r;r++)d[0]=
|
|
|
+k[q[2*m+r]],g=6*m+3*r,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){k=a.geometry.attributes.position.array;t=a.geometry.attributes.index.array;n=a.geometry.drawcalls;p=0;0===n.length&&(n=[{count:t.length,index:0,start:0}]);for(var q=new Uint32Array(2*t.length),s=0,v=n.length;s<v;++s)for(var r=n[s].start,u=n[s].count,g=n[s].index,m=r,y=r+u;m<y;m+=3)for(r=0;3>r;r++)d[0]=
|
|
|
g+t[m+r],d[1]=g+t[m+(r+1)%3],d.sort(f),u=d.toString(),void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++);d=new Float32Array(6*p);m=0;for(t=p;m<t;m++)for(r=0;2>r;r++)g=6*m+3*r,p=3*q[2*m+r],d[g+0]=k[p],d[g+1]=k[p+1],d[g+2]=k[p+2]}else for(k=a.geometry.attributes.position.array,p=k.length/3,q=p/3,d=new Float32Array(6*p),m=0,t=q;m<t;m++)for(r=0;3>r;r++)g=18*m+6*r,q=9*m+3*r,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],p=9*m+(r+1)%3*3,d[g+3]=k[p],d[g+4]=k[p+1],d[g+5]=k[p+2];h.addAttribute("position",new THREE.BufferAttribute(d,
|
|
|
3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper;THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
|