|
@@ -34,8 +34,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,multiplyVector3:function(a){v
|
|
|
b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;0===b&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*j;return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;
|
|
|
a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix3.__v1=new THREE.Vector3;THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,l,m,n,o,p,q){this.elements=new Float32Array(16);this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,j||0,void 0!==l?l:1,m||0,n||0,o||0,p||0,void 0!==q?q:1)};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,m,n,o,p,q){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=e;t[5]=f;t[9]=g;t[13]=h;t[2]=i;t[6]=j;t[10]=l;t[14]=m;t[3]=n;t[7]=o;t[11]=p;t[15]=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
|
|
|
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],o=c[2],p=c[6],q=c[10],t=c[14],r=c[3],C=c[7],w=c[11],c=c[15],s=d[0],H=d[4],z=d[8],
|
|
|
-u=d[12],y=d[1],D=d[5],A=d[9],I=d[13],J=d[2],B=d[6],K=d[10],F=d[14],L=d[3],P=d[7],N=d[11],d=d[15];e[0]=f*s+g*y+h*J+i*L;e[4]=f*H+g*D+h*B+i*P;e[8]=f*z+g*A+h*K+i*N;e[12]=f*u+g*I+h*F+i*d;e[1]=j*s+l*y+m*J+n*L;e[5]=j*H+l*D+m*B+n*P;e[9]=j*z+l*A+m*K+n*N;e[13]=j*u+l*I+m*F+n*d;e[2]=o*s+p*y+q*J+t*L;e[6]=o*H+p*D+q*B+t*P;e[10]=o*z+p*A+q*K+t*N;e[14]=o*u+p*I+q*F+t*d;e[3]=r*s+C*y+w*J+c*L;e[7]=r*H+C*D+w*B+c*P;e[11]=r*z+C*A+w*K+c*N;e[15]=r*u+C*I+w*F+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],o=c[2],p=c[6],q=c[10],t=c[14],r=c[3],C=c[7],y=c[11],c=c[15],s=d[0],H=d[4],z=d[8],
|
|
|
+v=d[12],u=d[1],D=d[5],A=d[9],I=d[13],J=d[2],B=d[6],K=d[10],F=d[14],L=d[3],P=d[7],N=d[11],d=d[15];e[0]=f*s+g*u+h*J+i*L;e[4]=f*H+g*D+h*B+i*P;e[8]=f*z+g*A+h*K+i*N;e[12]=f*v+g*I+h*F+i*d;e[1]=j*s+l*u+m*J+n*L;e[5]=j*H+l*D+m*B+n*P;e[9]=j*z+l*A+m*K+n*N;e[13]=j*v+l*I+m*F+n*d;e[2]=o*s+p*u+q*J+t*L;e[6]=o*H+p*D+q*B+t*P;e[10]=o*z+p*A+q*K+t*N;e[14]=o*v+p*I+q*F+t*d;e[3]=r*s+C*u+y*J+c*L;e[7]=r*H+C*D+y*B+c*P;e[11]=r*z+C*A+y*K+c*N;e[15]=r*v+C*I+y*F+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){var b=this.elements,
|
|
|
c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,c=0,d=a.length;c<d;c+=3)b.x=a[c],b.y=a[c+1],b.z=a[c+2],
|
|
|
this.multiplyVector3(b),a[c]=b.x,a[c+1]=b.y,a[c+2]=b.z;return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=
|
|
@@ -51,7 +51,7 @@ b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector
|
|
|
a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];
|
|
|
b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=
|
|
|
l*i+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,
|
|
|
-g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),m=1-j,n=d*e*m,o=d*f*m,m=e*f*m,d=d*l,p=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=o-p,n=n-l,h=h+(1-h)*j,l=m+d,o=o+p,m=m-d,i=i+(1-i)*j,j=c[0],d=c[1],p=c[2],q=c[3],t=c[4],r=c[5],C=c[6],w=c[7],s=c[8],H=c[9],z=c[10],u=c[11];c[0]=f*j+g*t+e*s;c[1]=f*d+g*r+e*H;c[2]=f*p+g*C+e*z;c[3]=f*q+g*w+e*u;c[4]=n*j+h*t+l*s;c[5]=n*d+h*r+l*H;c[6]=n*p+h*C+l*z;c[7]=n*q+h*w+l*u;c[8]=o*j+m*t+i*s;c[9]=o*d+m*r+i*H;c[10]=o*p+m*C+i*z;c[11]=o*q+m*w+i*u;
|
|
|
+g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),m=1-j,n=d*e*m,o=d*f*m,m=e*f*m,d=d*l,p=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=o-p,n=n-l,h=h+(1-h)*j,l=m+d,o=o+p,m=m-d,i=i+(1-i)*j,j=c[0],d=c[1],p=c[2],q=c[3],t=c[4],r=c[5],C=c[6],y=c[7],s=c[8],H=c[9],z=c[10],v=c[11];c[0]=f*j+g*t+e*s;c[1]=f*d+g*r+e*H;c[2]=f*p+g*C+e*z;c[3]=f*q+g*y+e*v;c[4]=n*j+h*t+l*s;c[5]=n*d+h*r+l*H;c[6]=n*p+h*C+l*z;c[7]=n*q+h*y+l*v;c[8]=o*j+m*t+i*s;c[9]=o*d+m*r+i*H;c[10]=o*p+m*C+i*z;c[11]=o*q+m*y+i*v;
|
|
|
return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);
|
|
|
this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,
|
|
|
b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/
|
|
@@ -61,8 +61,8 @@ THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;6>e;e++)if(b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w,b<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
(function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;new a.Vector3;var f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=new a.Vector3,j=new a.Vector3,l=new a.Vector3,m=function(a,b,c){i.sub(c,a);var d=i.dot(b),a=j.add(a,l.copy(b).multiplyScalar(d));return c.distanceTo(a)},n=function(a,b,c,d){i.sub(d,b);j.sub(c,b);l.sub(a,
|
|
|
b);var a=i.dot(i),b=i.dot(j),c=i.dot(l),e=j.dot(j),d=j.dot(l),f=1/(a*e-b*b),e=(e*c-b*d)*f,a=(a*d-b*c)*f;return 0<=e&&0<=a&&1>e+a},o=function(h,i,j){if(h instanceof a.Particle){var l=m(i.origin,i.direction,h.matrixWorld.getPosition());if(l>h.scale.x)return j;j.push({distance:l,point:h.position,face:null,object:h})}else if(h instanceof a.Mesh){var o=h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis(),l=m(i.origin,i.direction,h.matrixWorld.getPosition());if(l>o)return j;var o=h.geometry,
|
|
|
-p=o.vertices,H=h.material instanceof a.MeshFaceMaterial,z=!0===H?h.material.materials:null,l=h.material.side,u,y,D,A=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var I=0,J=o.faces.length;I<J;I++){var B=o.faces[I],l=!0===H?z[B.materialIndex]:h.material;if(void 0!==l&&(l=l.side,e.sub(B.centroid,c),y=B.normal,u=d.dot(y),!(Math.abs(u)<A)&&(y=y.dot(e)/u,!(0>
|
|
|
-y)&&(l===a.DoubleSide||(l===a.FrontSide?0>u:0<u)))))if(f.add(c,d.multiplyScalar(y)),B instanceof a.Face3)l=p[B.a],u=p[B.b],y=p[B.c],n(f,l,u,y)&&(u=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(u),l<i.near||l>i.far||j.push({distance:l,point:u,face:B,faceIndex:I,object:h}));else if(B instanceof a.Face4&&(l=p[B.a],u=p[B.b],y=p[B.c],D=p[B.d],n(f,l,u,D)||n(f,u,y,D)))u=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(u),l<i.near||l>i.far||j.push({distance:l,point:u,face:B,faceIndex:I,object:h})}}},
|
|
|
+p=o.vertices,H=h.material instanceof a.MeshFaceMaterial,z=!0===H?h.material.materials:null,l=h.material.side,v,u,D,A=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var I=0,J=o.faces.length;I<J;I++){var B=o.faces[I],l=!0===H?z[B.materialIndex]:h.material;if(void 0!==l&&(l=l.side,e.sub(B.centroid,c),u=B.normal,v=d.dot(u),!(Math.abs(v)<A)&&(u=u.dot(e)/v,!(0>
|
|
|
+u)&&(l===a.DoubleSide||(l===a.FrontSide?0>v:0<v)))))if(f.add(c,d.multiplyScalar(u)),B instanceof a.Face3)l=p[B.a],v=p[B.b],u=p[B.c],n(f,l,v,u)&&(v=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(v),l<i.near||l>i.far||j.push({distance:l,point:v,face:B,faceIndex:I,object:h}));else if(B instanceof a.Face4&&(l=p[B.a],v=p[B.b],u=p[B.c],D=p[B.d],n(f,l,v,D)||n(f,v,u,D)))v=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(v),l<i.near||l>i.far||j.push({distance:l,point:v,face:B,faceIndex:I,object:h})}}},
|
|
|
p=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)o(a[d],b,c)};a.Ray.prototype.precision=1E-4;a.Ray.prototype.set=function(a,b){this.origin=a;this.direction=b};a.Ray.prototype.intersectObject=function(a,b){var c=[];!0===b&&p(a,this,c);o(a,this,c);c.sort(h);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)o(a[d],this,c),!0===b&&p(a[d],this,c);c.sort(h);return c}})(THREE);
|
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,m){h=!1;b=f;c=g;d=l;e=m;a()};this.addPoint=function(f,g){!0===h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>
|
|
|
g?e:g);a()};this.add3Points=function(f,g,l,m,n,o){!0===h?(h=!1,b=f<l?f<n?f:n:l<n?l:n,c=g<m?g<o?g:o:m<o?m:o,d=f>l?f>n?f:n:l>n?l:n,e=g>m?g>o?g:o:m>o?m:o):(b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<m?g<o?g<c?g:c:o<c?o:c:m<o?m<c?m:c:o<c?o:c,d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,e=g>m?g>o?g>e?g:e:o>e?o:e:m>o?m>e?m:e:o>e?o:e);a()};this.addRectangle=function(f){!0===h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),
|
|
@@ -79,8 +79,8 @@ this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorldN
|
|
|
a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.boundRadius=this.boundRadius;a.boundRadiusScale=this.boundRadiusScale;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());
|
|
|
return a},deallocate:function(){var a=THREE.Object3DLibrary.indexOf(this);-1!==a&&THREE.Object3DLibrary.splice(a,1)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Object3DLibrary=[];
|
|
|
THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(j===m){var a=new THREE.RenderableVertex;l.push(a);m++;j++;return a}return l[j++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
-c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,j,l=[],m=0,n,o,p=[],q=0,t,r=[],C=0,w,s,H=[],z=0,u,y,D=[],A=0,I={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,B=new THREE.Vector4,K=new THREE.Matrix4,F=new THREE.Matrix4,L=new THREE.Matrix3,P=new THREE.Frustum,N=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);K.multiply(b.projectionMatrix,b.matrixWorldInverse);K.multiplyVector3(a);return a};
|
|
|
-this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);K.multiply(b.matrixWorld,b.projectionMatrixInverse);K.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(g,h,m,R){var $=h.near,fa=h.far,Ha=!1,G,ba,ha,Y,ia,ca,aa,na,eb,La,ya,pa,Ra,fb,ub;y=s=t=o=0;I.elements.length=0;g.updateMatrixWorld();
|
|
|
+c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,j,l=[],m=0,n,o,p=[],q=0,t,r=[],C=0,y,s,H=[],z=0,v,u,D=[],A=0,I={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,B=new THREE.Vector4,K=new THREE.Matrix4,F=new THREE.Matrix4,L=new THREE.Matrix3,P=new THREE.Frustum,N=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);K.multiply(b.projectionMatrix,b.matrixWorldInverse);K.multiplyVector3(a);return a};
|
|
|
+this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);K.multiply(b.matrixWorld,b.projectionMatrixInverse);K.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(g,h,m,R){var $=h.near,fa=h.far,Ha=!1,G,ba,ha,Y,ia,ca,aa,na,eb,La,ya,pa,Ra,fb,ub;u=s=t=o=0;I.elements.length=0;g.updateMatrixWorld();
|
|
|
void 0===h.parent&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);K.multiply(h.projectionMatrix,h.matrixWorldInverse);P.setFromMatrix(K);f=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var qb=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)I.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===P.contains(f))e=a(),e.object=f,null!==f.renderDepth?
|
|
|
e.z=f.renderDepth:(J.copy(f.matrixWorld.getPosition()),K.multiplyVector3(J),e.z=J.z),I.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(J.copy(f.matrixWorld.getPosition()),K.multiplyVector3(J),e.z=J.z),I.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(J.copy(f.matrixWorld.getPosition()),K.multiplyVector3(J),e.z=J.z),I.objects.push(e));qb(f)}}};qb(g);!0===m&&I.objects.sort(c);g=0;for(m=I.objects.length;g<
|
|
|
m;g++)if(na=I.objects[g].object,eb=na.matrixWorld,j=0,na instanceof THREE.Mesh){La=na.geometry;ha=La.vertices;ya=La.faces;La=La.faceVertexUvs;L.getInverse(eb);L.transpose();Ra=na.material instanceof THREE.MeshFaceMaterial;fb=!0===Ra?na.material:null;G=0;for(ba=ha.length;G<ba;G++)i=b(),i.positionWorld.copy(ha[G]),eb.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),K.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,
|
|
@@ -88,9 +88,9 @@ i.visible=i.positionScreen.z>$&&i.positionScreen.z<fa;ha=0;for(G=ya.length;ha<G;
|
|
|
q?(pa=new THREE.RenderableFace3,p.push(pa),q++,o++,n=pa):n=p[o++],n.v1.copy(Y),n.v2.copy(ia),n.v3.copy(aa);else continue;else continue;else if(ba instanceof THREE.Face4)if(Y=l[ba.a],ia=l[ba.b],aa=l[ba.c],pa=l[ba.d],!0===Y.visible&&!0===ia.visible&&!0===aa.visible&&!0===pa.visible)if(Ha=0>(pa.positionScreen.x-Y.positionScreen.x)*(ia.positionScreen.y-Y.positionScreen.y)-(pa.positionScreen.y-Y.positionScreen.y)*(ia.positionScreen.x-Y.positionScreen.x)||0>(ia.positionScreen.x-aa.positionScreen.x)*(pa.positionScreen.y-
|
|
|
aa.positionScreen.y)-(ia.positionScreen.y-aa.positionScreen.y)*(pa.positionScreen.x-aa.positionScreen.x),ca===THREE.DoubleSide||Ha===(ca===THREE.FrontSide)){if(t===C){var mb=new THREE.RenderableFace4;r.push(mb);C++;t++;n=mb}else n=r[t++];n.v1.copy(Y);n.v2.copy(ia);n.v3.copy(aa);n.v4.copy(pa)}else continue;else continue;n.normalWorld.copy(ba.normal);!1===Ha&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&n.normalWorld.negate();L.multiplyVector3(n.normalWorld).normalize();n.centroidWorld.copy(ba.centroid);
|
|
|
eb.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);K.multiplyVector3(n.centroidScreen);aa=ba.vertexNormals;Y=0;for(ia=aa.length;Y<ia;Y++)pa=n.vertexNormalsWorld[Y],pa.copy(aa[Y]),!1===Ha&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&pa.negate(),L.multiplyVector3(pa).normalize();n.vertexNormalsLength=aa.length;Y=0;for(ia=La.length;Y<ia;Y++)if(pa=La[Y][ha],void 0!==pa){ca=0;for(aa=pa.length;ca<aa;ca++)n.uvs[Y][ca]=pa[ca]}n.color=ba.color;n.material=ub;n.z=n.centroidScreen.z;
|
|
|
-I.elements.push(n)}}else if(na instanceof THREE.Line){F.multiply(K,eb);ha=na.geometry.vertices;Y=b();Y.positionScreen.copy(ha[0]);F.multiplyVector4(Y.positionScreen);eb=na.type===THREE.LinePieces?2:1;G=1;for(ba=ha.length;G<ba;G++)Y=b(),Y.positionScreen.copy(ha[G]),F.multiplyVector4(Y.positionScreen),0<(G+1)%eb||(ia=l[j-2],N.copy(Y.positionScreen),Q.copy(ia.positionScreen),!0===d(N,Q)&&(N.multiplyScalar(1/N.w),Q.multiplyScalar(1/Q.w),s===z?(ya=new THREE.RenderableLine,H.push(ya),z++,s++,w=ya):w=H[s++],
|
|
|
-w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(Q),w.z=Math.max(N.z,Q.z),w.material=na.material,I.elements.push(w)))}g=0;for(m=I.sprites.length;g<m;g++)na=I.sprites[g].object,eb=na.matrixWorld,na instanceof THREE.Particle&&(B.set(eb.elements[12],eb.elements[13],eb.elements[14],1),K.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z&&(y===A?($=new THREE.RenderableParticle,D.push($),A++,y++,u=$):u=D[y++],u.object=na,u.x=B.x/B.w,u.y=B.y/B.w,u.z=B.z,u.rotation=na.rotation.z,u.scale.x=na.scale.x*Math.abs(u.x-
|
|
|
-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),u.scale.y=na.scale.y*Math.abs(u.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),u.material=na.material,I.elements.push(u)));!0===R&&I.elements.sort(c);return I}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
+I.elements.push(n)}}else if(na instanceof THREE.Line){F.multiply(K,eb);ha=na.geometry.vertices;Y=b();Y.positionScreen.copy(ha[0]);F.multiplyVector4(Y.positionScreen);eb=na.type===THREE.LinePieces?2:1;G=1;for(ba=ha.length;G<ba;G++)Y=b(),Y.positionScreen.copy(ha[G]),F.multiplyVector4(Y.positionScreen),0<(G+1)%eb||(ia=l[j-2],N.copy(Y.positionScreen),Q.copy(ia.positionScreen),!0===d(N,Q)&&(N.multiplyScalar(1/N.w),Q.multiplyScalar(1/Q.w),s===z?(ya=new THREE.RenderableLine,H.push(ya),z++,s++,y=ya):y=H[s++],
|
|
|
+y.v1.positionScreen.copy(N),y.v2.positionScreen.copy(Q),y.z=Math.max(N.z,Q.z),y.material=na.material,I.elements.push(y)))}g=0;for(m=I.sprites.length;g<m;g++)na=I.sprites[g].object,eb=na.matrixWorld,na instanceof THREE.Particle&&(B.set(eb.elements[12],eb.elements[13],eb.elements[14],1),K.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z&&(u===A?($=new THREE.RenderableParticle,D.push($),A++,u++,v=$):v=D[u++],v.object=na,v.x=B.x/B.w,v.y=B.y/B.w,v.z=B.z,v.rotation=na.rotation.z,v.scale.x=na.scale.x*Math.abs(v.x-
|
|
|
+(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),v.scale.y=na.scale.y*Math.abs(v.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),v.material=na.material,I.elements.push(v)));!0===R&&I.elements.sort(c);return I}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*
|
|
|
h-f*g*e,this.w=c*d*e+f*g*h):"ZXY"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"ZYX"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e+f*g*h):"YZX"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e-f*g*h):"XZY"===b&&(this.x=f*d*e-c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e+f*g*h);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);
|
|
|
return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
@@ -114,9 +114,9 @@ d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d
|
|
|
computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<
|
|
|
b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(j)}g=this.morphNormals[a];f.vertices=
|
|
|
this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
|
|
|
-e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,y){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[e];m=g[f];n=g[y];o=i.x-h.x;p=j.x-h.x;q=i.y-h.y;t=j.y-h.y;r=i.z-h.z;C=j.z-h.z;w=m.u-l.u;s=n.u-l.u;H=m.v-l.v;z=n.v-l.v;u=1/(w*z-s*H);I.set((z*o-H*p)*u,(z*q-H*t)*u,(z*r-H*C)*u);J.set((w*p-s*o)*u,(w*t-s*q)*u,(w*C-s*r)*u);D[b].addSelf(I);D[c].addSelf(I);D[d].addSelf(I);A[b].addSelf(J);A[c].addSelf(J);A[d].addSelf(J)}var b,c,d,e,f,g,h,i,j,l,m,n,o,p,q,t,r,C,
|
|
|
-w,s,H,z,u,y,D=[],A=[],I=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3,K=new THREE.Vector3,F=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,A[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
|
|
|
-f.vertexNormals.length;d++)F.copy(f.vertexNormals[d]),e=f[L[d]],y=D[e],B.copy(y),B.subSelf(F.multiplyScalar(F.dot(y))).normalize(),K.cross(f.vertexNormals[d],y),e=K.dot(A[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3});
|
|
|
+e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,u){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[e];m=g[f];n=g[u];o=i.x-h.x;p=j.x-h.x;q=i.y-h.y;t=j.y-h.y;r=i.z-h.z;C=j.z-h.z;y=m.u-l.u;s=n.u-l.u;H=m.v-l.v;z=n.v-l.v;v=1/(y*z-s*H);I.set((z*o-H*p)*v,(z*q-H*t)*v,(z*r-H*C)*v);J.set((y*p-s*o)*v,(y*t-s*q)*v,(y*C-s*r)*v);D[b].addSelf(I);D[c].addSelf(I);D[d].addSelf(I);A[b].addSelf(J);A[c].addSelf(J);A[d].addSelf(J)}var b,c,d,e,f,g,h,i,j,l,m,n,o,p,q,t,r,C,
|
|
|
+y,s,H,z,v,u,D=[],A=[],I=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3,K=new THREE.Vector3,F=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,A[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
|
|
|
+f.vertexNormals.length;d++)F.copy(f.vertexNormals[d]),e=f[L[d]],u=D[e],B.copy(u),B.subSelf(F.multiplyScalar(F.dot(u))).normalize(),K.cross(f.vertexNormals[d],u),e=K.dot(A[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3});
|
|
|
if(0<this.vertices.length){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++)(a=this.vertices[d],a.x<b.x?b.x=a.x:a.x>c.x&&(c.x=a.x),a.y<b.y?b.y=a.y:a.y>c.y&&(c.y=a.y),a.z<b.z)?b.z=a.z:a.z>c.z&&(c.z=a.z)}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=0;null===this.boundingSphere&&(this.boundingSphere={radius:0});for(var b=
|
|
|
0,c=this.vertices.length;b<c;b++){var d=this.vertices[b].lengthSq();d>a&&(a=d)}this.boundingSphere.radius=Math.sqrt(a)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];
|
|
|
else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(e=3;0<e;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][f])&&i.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=
|
|
@@ -125,11 +125,11 @@ THREE.BufferGeometry=function(){THREE.GeometryLibrary.push(this);this.id=THREE.G
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3(Infinity,
|
|
|
Infinity,Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)});var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f+=3)(c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z)?b.min.z=e:e>b.max.z&&(b.max.z=e);if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){this.boundingSphere||(this.boundingSphere={radius:0});
|
|
|
var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
|
-0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,o,p=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,C=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var w=e[c].index;a=b;for(b+=i;a<b;a+=3)i=w+f[a],j=w+f[a+1],l=w+f[a+2],m=g[3*i],n=g[3*i+1],o=g[3*i+2],p.set(m,n,o),m=g[3*j],n=g[3*j+1],o=g[3*j+2],q.set(m,n,o),m=g[3*l],n=g[3*l+1],o=g[3*l+2],t.set(m,n,o),r.sub(t,q),C.sub(p,
|
|
|
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,o,p=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,C=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var y=e[c].index;a=b;for(b+=i;a<b;a+=3)i=y+f[a],j=y+f[a+1],l=y+f[a+2],m=g[3*i],n=g[3*i+1],o=g[3*i+2],p.set(m,n,o),m=g[3*j],n=g[3*j+1],o=g[3*j+2],q.set(m,n,o),m=g[3*l],n=g[3*l+1],o=g[3*l+2],t.set(m,n,o),r.sub(t,q),C.sub(p,
|
|
|
q),r.crossSelf(C),h[3*i]+=r.x,h[3*i+1]+=r.y,h[3*i+2]+=r.z,h[3*j]+=r.x,h[3*j+1]+=r.y,h[3*j+2]+=r.z,h[3*l]+=r.x,h[3*l+1]+=r.y,h[3*l+2]+=r.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){S.x=d[3*a];S.y=d[3*a+1];S.z=d[3*a+2];M.copy(S);R=i[a];N.copy(R);N.subSelf(S.multiplyScalar(S.dot(R))).normalize();
|
|
|
Q.cross(M,R);$=Q.dot(j[a]);O=0>$?-1:1;h[4*a]=N.x;h[4*a+1]=N.y;h[4*a+2]=N.z;h[4*a+3]=O}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=
|
|
|
-4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,m,n,o,p,q,t,r,C,w,s,H,z,u,y,f=new THREE.Vector3,g=new THREE.Vector3,D,A,I,J,B,K,F,L=this.offsets;I=0;for(J=L.length;I<J;++I){A=L[I].start;B=L[I].count;var P=L[I].index;D=A;for(A+=B;D<A;D+=3)B=P+b[D],K=P+b[D+1],F=P+b[D+2],l=c[3*B],m=c[3*B+1],n=c[3*B+2],o=c[3*K],p=c[3*K+1],q=c[3*K+2],t=c[3*F],r=c[3*F+1],C=c[3*
|
|
|
-F+2],w=e[2*B],s=e[2*B+1],H=e[2*K],z=e[2*K+1],u=e[2*F],y=e[2*F+1],o-=l,l=t-l,p-=m,m=r-m,q-=n,n=C-n,H-=w,w=u-w,z-=s,s=y-s,y=1/(H*s-w*z),f.set((s*o-z*l)*y,(s*p-z*m)*y,(s*q-z*n)*y),g.set((H*l-w*o)*y,(H*m-w*p)*y,(H*n-w*q)*y),i[B].addSelf(f),i[K].addSelf(f),i[F].addSelf(f),j[B].addSelf(g),j[K].addSelf(g),j[F].addSelf(g)}var N=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3,M=new THREE.Vector3,O,R,$;I=0;for(J=L.length;I<J;++I){A=L[I].start;B=L[I].count;P=L[I].index;D=A;for(A+=B;D<A;D+=3)B=P+b[D],
|
|
|
+4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,m,n,o,p,q,t,r,C,y,s,H,z,v,u,f=new THREE.Vector3,g=new THREE.Vector3,D,A,I,J,B,K,F,L=this.offsets;I=0;for(J=L.length;I<J;++I){A=L[I].start;B=L[I].count;var P=L[I].index;D=A;for(A+=B;D<A;D+=3)B=P+b[D],K=P+b[D+1],F=P+b[D+2],l=c[3*B],m=c[3*B+1],n=c[3*B+2],o=c[3*K],p=c[3*K+1],q=c[3*K+2],t=c[3*F],r=c[3*F+1],C=c[3*
|
|
|
+F+2],y=e[2*B],s=e[2*B+1],H=e[2*K],z=e[2*K+1],v=e[2*F],u=e[2*F+1],o-=l,l=t-l,p-=m,m=r-m,q-=n,n=C-n,H-=y,y=v-y,z-=s,s=u-s,u=1/(H*s-y*z),f.set((s*o-z*l)*u,(s*p-z*m)*u,(s*q-z*n)*u),g.set((H*l-y*o)*u,(H*m-y*p)*u,(H*n-y*q)*u),i[B].addSelf(f),i[K].addSelf(f),i[F].addSelf(f),j[B].addSelf(g),j[K].addSelf(g),j[F].addSelf(g)}var N=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3,M=new THREE.Vector3,O,R,$;I=0;for(J=L.length;I<J;++I){A=L[I].start;B=L[I].count;P=L[I].index;D=A;for(A+=B;D<A;D+=3)B=P+b[D],
|
|
|
K=P+b[D+1],F=P+b[D+2],a(B),a(K),a(F)}this.tangentsNeedUpdate=this.hasTangents=!0}},deallocate:function(){var a=THREE.GeometryLibrary.indexOf(this);-1!==a&&THREE.GeometryLibrary.splice(a,1)}};
|
|
|
THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,l,m,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
f+2;j=this.points[c[0]];l=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,m.x,n.x,g,h,i);d.y=b(j.y,l.y,m.y,n.y,g,h,i);d.z=b(j.z,l.z,m.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
@@ -147,7 +147,7 @@ THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new T
|
|
|
this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,t){var r=f.toLowerCase().endsWith(".dds"),C=b+"/"+f;if(r){var w=THREE.ImageUtils.loadCompressedTexture(C);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,t){var r=f.toLowerCase().endsWith(".dds"),C=b+"/"+f;if(r){var y=THREE.ImageUtils.loadCompressedTexture(C);a[e]=y}else y=document.createElement("canvas"),a[e]=new THREE.Texture(y);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
|
|
|
void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]))a[e].wrapT=f[j[1]];t&&(a[e].anisotropy=t);if(!r){var s=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);s.image.width=a;s.image.height=b;s.image.getContext("2d").drawImage(this,0,0,a,b)}else s.image=this;s.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=C}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
@@ -158,47 +158,47 @@ THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c&&"string"===typeof c
|
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var c=f.response;void 0===c&&(c=(new Uint8Array(f.responseBody)).buffer);THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else 3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):
|
|
|
2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(){var b,c,d,e,j,l,m,n,o,p,q,t,r,C,w,s;function H(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function u(a,b){return(new Uint32Array(a,b,1))[0]}function y(b,c){var d,e,f,g,h,i,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++)e=l[3*d],f=l[3*d+1],g=l[3*d+2],h=P[2*e],e=P[2*e+1],i=P[2*f],j=P[2*f+1],f=P[2*g],g=P[2*g+1],K.faceVertexUvs[0].push([new THREE.UV(h,e),new THREE.UV(i,j),new THREE.UV(f,g)])}function D(b,
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(){var b,c,d,e,j,l,m,n,o,p,q,t,r,C,y,s;function H(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function v(a,b){return(new Uint32Array(a,b,1))[0]}function u(b,c){var d,e,f,g,h,i,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++)e=l[3*d],f=l[3*d+1],g=l[3*d+2],h=P[2*e],e=P[2*e+1],i=P[2*f],j=P[2*f+1],f=P[2*g],g=P[2*g+1],K.faceVertexUvs[0].push([new THREE.UV(h,e),new THREE.UV(i,j),new THREE.UV(f,g)])}function D(b,
|
|
|
c){var d,e,f,g,h,i,j,l,n,m=new Uint32Array(a,c,4*b);for(d=0;d<b;d++)e=m[4*d],f=m[4*d+1],g=m[4*d+2],h=m[4*d+3],i=P[2*e],e=P[2*e+1],j=P[2*f],l=P[2*f+1],f=P[2*g],n=P[2*g+1],g=P[2*h],h=P[2*h+1],K.faceVertexUvs[0].push([new THREE.UV(i,e),new THREE.UV(j,l),new THREE.UV(f,n),new THREE.UV(g,h)])}function A(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],K.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,
|
|
|
f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],K.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];l=d[3*e+1];n=d[3*e+2];i=m[e];var o=L[3*l],p=L[3*l+1];l=L[3*l+2];var q=L[3*n],r=L[3*n+1];n=L[3*n+2];K.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(L[3*
|
|
|
-j],L[3*j+1],L[3*j+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(q,r,n)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];n=d[4*e+1];m=d[4*e+2];o=d[4*e+3];j=p[e];var q=L[3*n],r=L[3*n+1];n=L[3*n+2];var s=L[3*m],t=L[3*m+1];m=L[3*m+2];var u=L[3*o],w=L[3*o+1];o=L[3*o+2];K.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(L[3*l],L[3*l+1],L[3*l+2]),new THREE.Vector3(q,
|
|
|
-r,n),new THREE.Vector3(s,t,m),new THREE.Vector3(u,w,o)],null,j))}}var K=this,F=0,L=[],P=[],N,Q,S;THREE.Geometry.call(this);s=a;Q=F;C=new Uint8Array(s,Q,12);p="";for(r=0;12>r;r++)p+=String.fromCharCode(C[Q+r]);b=z(s,Q+12);z(s,Q+13);z(s,Q+14);z(s,Q+15);c=z(s,Q+16);d=z(s,Q+17);e=z(s,Q+18);j=z(s,Q+19);l=u(s,Q+20);m=u(s,Q+20+4);n=u(s,Q+20+8);o=u(s,Q+20+12);p=u(s,Q+20+16);q=u(s,Q+20+20);t=u(s,Q+20+24);r=u(s,Q+20+28);C=u(s,Q+20+32);w=u(s,Q+20+36);s=u(s,Q+20+40);F+=b;Q=3*c+j;S=4*c+j;N=o*Q;b=p*(Q+3*d);c=q*
|
|
|
-(Q+3*e);j=t*(Q+3*d+3*e);Q=r*S;d=C*(S+4*d);e=w*(S+4*e);S=F;var F=new Float32Array(a,F,3*l),M,O,R,$;for(M=0;M<l;M++)O=F[3*M],R=F[3*M+1],$=F[3*M+2],K.vertices.push(new THREE.Vector3(O,R,$));l=F=S+3*l*Float32Array.BYTES_PER_ELEMENT;if(m){F=new Int8Array(a,F,3*m);for(S=0;S<m;S++)M=F[3*S],O=F[3*S+1],R=F[3*S+2],L.push(M/127,O/127,R/127)}F=l+3*m*Int8Array.BYTES_PER_ELEMENT;m=F+=H(3*m);if(n){l=new Float32Array(a,F,2*n);for(F=0;F<n;F++)S=l[2*F],M=l[2*F+1],P.push(S,M)}n=F=m+2*n*Float32Array.BYTES_PER_ELEMENT;
|
|
|
-N=n+N+H(2*o);m=N+b+H(2*p);b=m+c+H(2*q);c=b+j+H(2*t);Q=c+Q+H(2*r);j=Q+d+H(2*C);d=j+e+H(2*w);q&&(e=m+3*q*Uint32Array.BYTES_PER_ELEMENT,A(q,m,e+3*q*Uint32Array.BYTES_PER_ELEMENT),y(q,e));t&&(q=b+3*t*Uint32Array.BYTES_PER_ELEMENT,e=q+3*t*Uint32Array.BYTES_PER_ELEMENT,J(t,b,q,e+3*t*Uint32Array.BYTES_PER_ELEMENT),y(t,e));w&&(t=j+4*w*Uint32Array.BYTES_PER_ELEMENT,I(w,j,t+4*w*Uint32Array.BYTES_PER_ELEMENT),D(w,t));s&&(w=d+4*s*Uint32Array.BYTES_PER_ELEMENT,t=w+4*s*Uint32Array.BYTES_PER_ELEMENT,B(s,d,w,t+4*
|
|
|
+j],L[3*j+1],L[3*j+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(q,r,n)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];n=d[4*e+1];m=d[4*e+2];o=d[4*e+3];j=p[e];var q=L[3*n],r=L[3*n+1];n=L[3*n+2];var s=L[3*m],t=L[3*m+1];m=L[3*m+2];var u=L[3*o],v=L[3*o+1];o=L[3*o+2];K.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(L[3*l],L[3*l+1],L[3*l+2]),new THREE.Vector3(q,
|
|
|
+r,n),new THREE.Vector3(s,t,m),new THREE.Vector3(u,v,o)],null,j))}}var K=this,F=0,L=[],P=[],N,Q,S;THREE.Geometry.call(this);s=a;Q=F;C=new Uint8Array(s,Q,12);p="";for(r=0;12>r;r++)p+=String.fromCharCode(C[Q+r]);b=z(s,Q+12);z(s,Q+13);z(s,Q+14);z(s,Q+15);c=z(s,Q+16);d=z(s,Q+17);e=z(s,Q+18);j=z(s,Q+19);l=v(s,Q+20);m=v(s,Q+20+4);n=v(s,Q+20+8);o=v(s,Q+20+12);p=v(s,Q+20+16);q=v(s,Q+20+20);t=v(s,Q+20+24);r=v(s,Q+20+28);C=v(s,Q+20+32);y=v(s,Q+20+36);s=v(s,Q+20+40);F+=b;Q=3*c+j;S=4*c+j;N=o*Q;b=p*(Q+3*d);c=q*
|
|
|
+(Q+3*e);j=t*(Q+3*d+3*e);Q=r*S;d=C*(S+4*d);e=y*(S+4*e);S=F;var F=new Float32Array(a,F,3*l),M,O,R,$;for(M=0;M<l;M++)O=F[3*M],R=F[3*M+1],$=F[3*M+2],K.vertices.push(new THREE.Vector3(O,R,$));l=F=S+3*l*Float32Array.BYTES_PER_ELEMENT;if(m){F=new Int8Array(a,F,3*m);for(S=0;S<m;S++)M=F[3*S],O=F[3*S+1],R=F[3*S+2],L.push(M/127,O/127,R/127)}F=l+3*m*Int8Array.BYTES_PER_ELEMENT;m=F+=H(3*m);if(n){l=new Float32Array(a,F,2*n);for(F=0;F<n;F++)S=l[2*F],M=l[2*F+1],P.push(S,M)}n=F=m+2*n*Float32Array.BYTES_PER_ELEMENT;
|
|
|
+N=n+N+H(2*o);m=N+b+H(2*p);b=m+c+H(2*q);c=b+j+H(2*t);Q=c+Q+H(2*r);j=Q+d+H(2*C);d=j+e+H(2*y);q&&(e=m+3*q*Uint32Array.BYTES_PER_ELEMENT,A(q,m,e+3*q*Uint32Array.BYTES_PER_ELEMENT),u(q,e));t&&(q=b+3*t*Uint32Array.BYTES_PER_ELEMENT,e=q+3*t*Uint32Array.BYTES_PER_ELEMENT,J(t,b,q,e+3*t*Uint32Array.BYTES_PER_ELEMENT),u(t,e));y&&(t=j+4*y*Uint32Array.BYTES_PER_ELEMENT,I(y,j,t+4*y*Uint32Array.BYTES_PER_ELEMENT),D(y,t));s&&(y=d+4*s*Uint32Array.BYTES_PER_ELEMENT,t=y+4*s*Uint32Array.BYTES_PER_ELEMENT,B(s,d,y,t+4*
|
|
|
s*Uint32Array.BYTES_PER_ELEMENT),D(s,t));o&&A(o,n,n+3*o*Uint32Array.BYTES_PER_ELEMENT);p&&(o=N+3*p*Uint32Array.BYTES_PER_ELEMENT,J(p,N,o,o+3*p*Uint32Array.BYTES_PER_ELEMENT));r&&I(r,c,c+4*r*Uint32Array.BYTES_PER_ELEMENT);C&&(p=Q+4*C*Uint32Array.BYTES_PER_ELEMENT,B(C,Q,p,p+4*C*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals()};e.prototype=Object.create(THREE.Geometry.prototype);e=new e(c);c=this.initMaterials(d,c);this.needsTangents(c)&&e.computeTangents();b(e,c)};
|
|
|
THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};
|
|
|
THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.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.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===
|
|
|
f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,j,l,m,n,o,p,q,t,r,C,w,s=a.faces;p=a.vertices;var H=a.normals,z=a.colors,u=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&u++;for(f=0;f<u;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(j=p.length;i<j;)l=new THREE.Vector3,l.x=p[i++]*e,l.y=p[i++]*e,l.z=p[i++]*e,d.vertices.push(l);i=0;for(j=s.length;i<j;){p=s[i++];l=p&1;h=p&2;f=p&4;g=p&8;n=p&16;m=p&32;q=p&64;p&=128;l?(t=new THREE.Face4,
|
|
|
-t.a=s[i++],t.b=s[i++],t.c=s[i++],t.d=s[i++],l=4):(t=new THREE.Face3,t.a=s[i++],t.b=s[i++],t.c=s[i++],l=3);h&&(h=s[i++],t.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<u;f++)r=a.uvs[f],o=s[i++],w=r[2*o],o=r[2*o+1],d.faceUvs[f][h]=new THREE.UV(w,o);if(g)for(f=0;f<u;f++){r=a.uvs[f];C=[];for(g=0;g<l;g++)o=s[i++],w=r[2*o],o=r[2*o+1],C[g]=new THREE.UV(w,o);d.faceVertexUvs[f][h]=C}n&&(n=3*s[i++],g=new THREE.Vector3,g.x=H[n++],g.y=H[n++],g.z=H[n],t.normal=g);if(m)for(f=0;f<l;f++)n=3*s[i++],g=new THREE.Vector3,
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,j,l,m,n,o,p,q,t,r,C,y,s=a.faces;p=a.vertices;var H=a.normals,z=a.colors,v=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&v++;for(f=0;f<v;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(j=p.length;i<j;)l=new THREE.Vector3,l.x=p[i++]*e,l.y=p[i++]*e,l.z=p[i++]*e,d.vertices.push(l);i=0;for(j=s.length;i<j;){p=s[i++];l=p&1;h=p&2;f=p&4;g=p&8;n=p&16;m=p&32;q=p&64;p&=128;l?(t=new THREE.Face4,
|
|
|
+t.a=s[i++],t.b=s[i++],t.c=s[i++],t.d=s[i++],l=4):(t=new THREE.Face3,t.a=s[i++],t.b=s[i++],t.c=s[i++],l=3);h&&(h=s[i++],t.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<v;f++)r=a.uvs[f],o=s[i++],y=r[2*o],o=r[2*o+1],d.faceUvs[f][h]=new THREE.UV(y,o);if(g)for(f=0;f<v;f++){r=a.uvs[f];C=[];for(g=0;g<l;g++)o=s[i++],y=r[2*o],o=r[2*o+1],C[g]=new THREE.UV(y,o);d.faceVertexUvs[f][h]=C}n&&(n=3*s[i++],g=new THREE.Vector3,g.x=H[n++],g.y=H[n++],g.z=H[n],t.normal=g);if(m)for(f=0;f<l;f++)n=3*s[i++],g=new THREE.Vector3,
|
|
|
g.x=H[n++],g.y=H[n++],g.z=H[n],t.vertexNormals.push(g);q&&(m=s[i++],m=new THREE.Color(z[m]),t.color=m);if(p)for(f=0;f<l;f++)m=s[i++],m=new THREE.Color(z[m]),t.vertexColors.push(m);d.faces.push(t)}if(a.skinWeights){i=0;for(j=a.skinWeights.length;i<j;i+=2)s=a.skinWeights[i],H=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(s,H,0,0))}if(a.skinIndices){i=0;for(j=a.skinIndices.length;i<j;i+=2)s=a.skinIndices[i],H=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(s,H,0,0))}d.bones=a.bones;
|
|
|
-d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(j=a.morphTargets.length;i<j;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];z=d.morphTargets[i].vertices;u=a.morphTargets[i].vertices;s=0;for(H=u.length;s<H;s+=3)p=new THREE.Vector3,p.x=u[s]*e,p.y=u[s+1]*e,p.z=u[s+2]*e,z.push(p)}}if(void 0!==a.morphColors){i=0;for(j=a.morphColors.length;i<j;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=[];
|
|
|
-H=d.morphColors[i].colors;z=a.morphColors[i].colors;e=0;for(s=z.length;e<s;e+=3)u=new THREE.Color(16755200),u.setRGB(z[e],z[e+1],z[e+2]),H.push(u)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};
|
|
|
+d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(j=a.morphTargets.length;i<j;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];z=d.morphTargets[i].vertices;v=a.morphTargets[i].vertices;s=0;for(H=v.length;s<H;s+=3)p=new THREE.Vector3,p.x=v[s]*e,p.y=v[s+1]*e,p.z=v[s+2]*e,z.push(p)}}if(void 0!==a.morphColors){i=0;for(j=a.morphColors.length;i<j;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=[];
|
|
|
+H=d.morphColors[i].colors;z=a.morphColors[i].colors;e=0;for(s=z.length;e<s;e+=3)v=new THREE.Color(16755200),v.setRGB(z[e],z[e+1],z[e+2]),H.push(v)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};
|
|
|
THREE.LoadingMonitor=function(){THREE.EventTarget.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader);this.addGeometryHandler("binary",THREE.BinaryLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
|
THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(M.scene,R.objects)}function f(a,b){for(var c in b)if(void 0===M.objects[c]){var e=b[c],g=null;if(e.type&&e.type in l.hierarchyHandlerMap&&void 0===e.loading){var i={},j;for(j in t)"type"!==j&&"url"!==j&&(i[j]=t[j]);A=M.materials[e.material];e.loading=!0;var n=l.hierarchyHandlerMap[e.type].loaderObject;n.addEventListener?(n.addEventListener("load",h(c,a,A,e)),n.load(d(e.url,R.urlBaseType))):
|
|
|
-n.options?n.load(d(e.url,R.urlBaseType),h(c,a,A,e)):n.load(d(e.url,R.urlBaseType),h(c,a,A,e),i)}else if(void 0!==e.geometry){if(D=M.geometries[e.geometry]){g=!1;A=M.materials[e.material];g=A instanceof THREE.ShaderMaterial;w=e.position;s=e.rotation;H=e.quaternion;z=e.scale;r=e.matrix;H=0;e.material||(A=new THREE.MeshFaceMaterial(M.face_materials[e.geometry]));A instanceof THREE.MeshFaceMaterial&&0===A.materials.length&&(A=new THREE.MeshFaceMaterial(M.face_materials[e.geometry]));if(A instanceof THREE.MeshFaceMaterial)for(i=
|
|
|
+n.options?n.load(d(e.url,R.urlBaseType),h(c,a,A,e)):n.load(d(e.url,R.urlBaseType),h(c,a,A,e),i)}else if(void 0!==e.geometry){if(D=M.geometries[e.geometry]){g=!1;A=M.materials[e.material];g=A instanceof THREE.ShaderMaterial;y=e.position;s=e.rotation;H=e.quaternion;z=e.scale;r=e.matrix;H=0;e.material||(A=new THREE.MeshFaceMaterial(M.face_materials[e.geometry]));A instanceof THREE.MeshFaceMaterial&&0===A.materials.length&&(A=new THREE.MeshFaceMaterial(M.face_materials[e.geometry]));if(A instanceof THREE.MeshFaceMaterial)for(i=
|
|
|
0;i<A.materials.length;i++)g=g||A.materials[i]instanceof THREE.ShaderMaterial;g&&D.computeTangents();e.skin?g=new THREE.SkinnedMesh(D,A):e.morph?(g=new THREE.MorphAnimMesh(D,A),void 0!==e.duration&&(g.duration=e.duration),void 0!==e.time&&(g.time=e.time),void 0!==e.mirroredLoop&&(g.mirroredLoop=e.mirroredLoop),A.morphNormals&&D.computeMorphNormals()):g=new THREE.Mesh(D,A);g.name=c;r?(g.matrixAutoUpdate=!1,g.matrix.set(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],
|
|
|
-r[15])):(g.position.set(w[0],w[1],w[2]),H?(g.quaternion.set(H[0],H[1],H[2],H[3]),g.useQuaternion=!0):g.rotation.set(s[0],s[1],s[2]),g.scale.set(z[0],z[1],z[2]));g.visible=e.visible;g.castShadow=e.castShadow;g.receiveShadow=e.receiveShadow;a.add(g);M.objects[c]=g}}else"DirectionalLight"===e.type||"PointLight"===e.type||"AmbientLight"===e.type?(F=void 0!==e.color?e.color:16777215,L=void 0!==e.intensity?e.intensity:1,"DirectionalLight"===e.type?(w=e.direction,K=new THREE.DirectionalLight(F,L),K.position.set(w[0],
|
|
|
-w[1],w[2]),e.target&&(O.push({object:K,targetName:e.target}),K.target=null)):"PointLight"===e.type?(w=e.position,C=e.distance,K=new THREE.PointLight(F,L,C),K.position.set(w[0],w[1],w[2])):"AmbientLight"===e.type&&(K=new THREE.AmbientLight(F)),a.add(K),K.name=c,M.lights[c]=K,M.objects[c]=K):"PerspectiveCamera"===e.type||"OrthographicCamera"===e.type?("PerspectiveCamera"===e.type?I=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far):"OrthographicCamera"===e.type&&(I=new THREE.OrthographicCamera(u.left,
|
|
|
-u.right,u.top,u.bottom,u.near,u.far)),w=e.position,I.position.set(w[0],w[1],w[2]),a.add(I),I.name=c,M.cameras[c]=I,M.objects[c]=I):(w=e.position,s=e.rotation,H=e.quaternion,z=e.scale,H=0,g=new THREE.Object3D,g.name=c,g.position.set(w[0],w[1],w[2]),H?(g.quaternion.set(H[0],H[1],H[2],H[3]),g.useQuaternion=!0):g.rotation.set(s[0],s[1],s[2]),g.scale.set(z[0],z[1],z[2]),g.visible=void 0!==e.visible?e.visible:!1,a.add(g),M.objects[c]=g,M.empties[c]=g);if(g){if(void 0!==e.properties)for(var m in e.properties)g.properties[m]=
|
|
|
+r[15])):(g.position.set(y[0],y[1],y[2]),H?(g.quaternion.set(H[0],H[1],H[2],H[3]),g.useQuaternion=!0):g.rotation.set(s[0],s[1],s[2]),g.scale.set(z[0],z[1],z[2]));g.visible=e.visible;g.castShadow=e.castShadow;g.receiveShadow=e.receiveShadow;a.add(g);M.objects[c]=g}}else"DirectionalLight"===e.type||"PointLight"===e.type||"AmbientLight"===e.type?(F=void 0!==e.color?e.color:16777215,L=void 0!==e.intensity?e.intensity:1,"DirectionalLight"===e.type?(y=e.direction,K=new THREE.DirectionalLight(F,L),K.position.set(y[0],
|
|
|
+y[1],y[2]),e.target&&(O.push({object:K,targetName:e.target}),K.target=null)):"PointLight"===e.type?(y=e.position,C=e.distance,K=new THREE.PointLight(F,L,C),K.position.set(y[0],y[1],y[2])):"AmbientLight"===e.type&&(K=new THREE.AmbientLight(F)),a.add(K),K.name=c,M.lights[c]=K,M.objects[c]=K):"PerspectiveCamera"===e.type||"OrthographicCamera"===e.type?("PerspectiveCamera"===e.type?I=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far):"OrthographicCamera"===e.type&&(I=new THREE.OrthographicCamera(v.left,
|
|
|
+v.right,v.top,v.bottom,v.near,v.far)),y=e.position,I.position.set(y[0],y[1],y[2]),a.add(I),I.name=c,M.cameras[c]=I,M.objects[c]=I):(y=e.position,s=e.rotation,H=e.quaternion,z=e.scale,H=0,g=new THREE.Object3D,g.name=c,g.position.set(y[0],y[1],y[2]),H?(g.quaternion.set(H[0],H[1],H[2],H[3]),g.useQuaternion=!0):g.rotation.set(s[0],s[1],s[2]),g.scale.set(z[0],z[1],z[2]),g.visible=void 0!==e.visible?e.visible:!1,a.add(g),M.objects[c]=g,M.empties[c]=g);if(g){if(void 0!==e.properties)for(var m in e.properties)g.properties[m]=
|
|
|
e.properties[m];void 0!==e.children&&f(g,e.children)}}}function g(a){return function(b,c){M.geometries[a]=b;M.face_materials[a]=c;e();P-=1;l.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,n=d.scale;f.position.set(g[0],g[1],g[2]);i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(n[0],n[1],n[2]);c&&f.traverse(function(a){a.material=c});b.add(f);M.objects[a]=
|
|
|
f;e();P-=1;l.onLoadComplete();j()}}function i(a){return function(b,c){M.geometries[a]=b;M.face_materials[a]=c}}function j(){l.callbackProgress({totalModels:Q,totalTextures:S,loadedModels:Q-P,loadedTextures:S-N},M);l.onLoadProgress();if(0===P&&0===N){for(var a=0;a<O.length;a++){var c=O[a],d=M.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,M.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(M)}}var l=this,m=THREE.Loader.prototype.extractUrlBase(c),
|
|
|
-n,o,p,q,t,r,C,w,s,H,z,u,y,D,A,I,J,B,K,F,L,P,N,Q,S,M,O=[],R=a,$;for($ in this.geometryHandlerMap)a=this.geometryHandlerMap[$].loaderClass,this.geometryHandlerMap[$].loaderObject=new a;for($ in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[$].loaderClass,this.hierarchyHandlerMap[$].loaderObject=new a;N=P=0;M={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(R.transform&&($=R.transform.position,a=R.transform.rotation,
|
|
|
-c=R.transform.scale,$&&M.scene.position.set($[0],$[1],$[2]),a&&M.scene.rotation.set(a[0],a[1],a[2]),c&&M.scene.scale.set(c[0],c[1],c[2]),$||a||c))M.scene.updateMatrix(),M.scene.updateMatrixWorld();$=function(a){return function(){N-=a;j();l.onLoadComplete()}};for(p in R.fogs)a=R.fogs[p],"linear"===a.type?J=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(J=new THREE.FogExp2(0,a.density)),u=a.color,J.color.setRGB(u[0],u[1],u[2]),M.fogs[p]=J;for(n in R.geometries)t=R.geometries[n],t.type in this.geometryHandlerMap&&
|
|
|
+n,o,p,q,t,r,C,y,s,H,z,v,u,D,A,I,J,B,K,F,L,P,N,Q,S,M,O=[],R=a,$;for($ in this.geometryHandlerMap)a=this.geometryHandlerMap[$].loaderClass,this.geometryHandlerMap[$].loaderObject=new a;for($ in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[$].loaderClass,this.hierarchyHandlerMap[$].loaderObject=new a;N=P=0;M={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(R.transform&&($=R.transform.position,a=R.transform.rotation,
|
|
|
+c=R.transform.scale,$&&M.scene.position.set($[0],$[1],$[2]),a&&M.scene.rotation.set(a[0],a[1],a[2]),c&&M.scene.scale.set(c[0],c[1],c[2]),$||a||c))M.scene.updateMatrix(),M.scene.updateMatrixWorld();$=function(a){return function(){N-=a;j();l.onLoadComplete()}};for(p in R.fogs)a=R.fogs[p],"linear"===a.type?J=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(J=new THREE.FogExp2(0,a.density)),v=a.color,J.color.setRGB(v[0],v[1],v[2]),M.fogs[p]=J;for(n in R.geometries)t=R.geometries[n],t.type in this.geometryHandlerMap&&
|
|
|
(P+=1,l.onLoadStart());for(var fa in R.objects)p=R.objects[fa],p.type&&p.type in this.hierarchyHandlerMap&&(P+=1,l.onLoadStart());Q=P;for(n in R.geometries)if(t=R.geometries[n],"cube"===t.type)D=new THREE.CubeGeometry(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments),M.geometries[n]=D;else if("plane"===t.type)D=new THREE.PlaneGeometry(t.width,t.height,t.widthSegments,t.heightSegments),M.geometries[n]=D;else if("sphere"===t.type)D=new THREE.SphereGeometry(t.radius,t.widthSegments,
|
|
|
t.heightSegments),M.geometries[n]=D;else if("cylinder"===t.type)D=new THREE.CylinderGeometry(t.topRad,t.botRad,t.height,t.radSegs,t.heightSegs),M.geometries[n]=D;else if("torus"===t.type)D=new THREE.TorusGeometry(t.radius,t.tube,t.segmentsR,t.segmentsT),M.geometries[n]=D;else if("icosahedron"===t.type)D=new THREE.IcosahedronGeometry(t.radius,t.subdivisions),M.geometries[n]=D;else if(t.type in this.geometryHandlerMap){fa={};for(B in t)"type"!==B&&"url"!==B&&(fa[B]=t[B]);this.geometryHandlerMap[t.type].loaderObject.load(d(t.url,
|
|
|
R.urlBaseType),g(n),fa)}else"embedded"===t.type&&(fa=R.embeds[t.id],fa.metadata=R.metadata,fa&&this.geometryHandlerMap.ascii.loaderObject.createModel(fa,i(n),""));for(q in R.textures)if(n=R.textures[q],n.url instanceof Array){N+=n.url.length;for(B=0;B<n.url.length;B++)l.onLoadStart()}else N+=1,l.onLoadStart();S=N;for(q in R.textures){n=R.textures[q];void 0!==n.mapping&&void 0!==THREE[n.mapping]&&(n.mapping=new THREE[n.mapping]);if(n.url instanceof Array){fa=n.url.length;p=[];for(B=0;B<fa;B++)p[B]=
|
|
|
d(n.url[B],R.urlBaseType);B=(B=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,n.mapping,$(fa)):THREE.ImageUtils.loadTextureCube(p,n.mapping,$(fa))}else{B=n.url.toLowerCase().endsWith(".dds");fa=d(n.url,R.urlBaseType);p=$(1);B=B?THREE.ImageUtils.loadCompressedTexture(fa,n.mapping,p):THREE.ImageUtils.loadTexture(fa,n.mapping,p);void 0!==THREE[n.minFilter]&&(B.minFilter=THREE[n.minFilter]);void 0!==THREE[n.magFilter]&&(B.magFilter=THREE[n.magFilter]);n.anisotropy&&(B.anisotropy=
|
|
|
-n.anisotropy);if(n.repeat&&(B.repeat.set(n.repeat[0],n.repeat[1]),1!==n.repeat[0]&&(B.wrapS=THREE.RepeatWrapping),1!==n.repeat[1]))B.wrapT=THREE.RepeatWrapping;n.offset&&B.offset.set(n.offset[0],n.offset[1]);if(n.wrap&&(fa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==fa[n.wrap[0]]&&(B.wrapS=fa[n.wrap[0]]),void 0!==fa[n.wrap[1]]))B.wrapT=fa[n.wrap[1]]}M.textures[q]=B}for(o in R.materials){r=R.materials[o];for(y in r.parameters)"envMap"===y||"map"===y||"lightMap"===y||
|
|
|
-"bumpMap"===y?r.parameters[y]=M.textures[r.parameters[y]]:"shading"===y?r.parameters[y]="flat"===r.parameters[y]?THREE.FlatShading:THREE.SmoothShading:"side"===y?r.parameters[y]="double"==r.parameters[y]?THREE.DoubleSide:"back"==r.parameters[y]?THREE.BackSide:THREE.FrontSide:"blending"===y?r.parameters[y]=r.parameters[y]in THREE?THREE[r.parameters[y]]:THREE.NormalBlending:"combine"===y?r.parameters[y]="MixOperation"==r.parameters[y]?THREE.MixOperation:THREE.MultiplyOperation:"vertexColors"===y?"face"==
|
|
|
-r.parameters[y]?r.parameters[y]=THREE.FaceColors:r.parameters[y]&&(r.parameters[y]=THREE.VertexColors):"wrapRGB"===y&&(q=r.parameters[y],r.parameters[y]=new THREE.Vector3(q[0],q[1],q[2]));void 0!==r.parameters.opacity&&1>r.parameters.opacity&&(r.parameters.transparent=!0);r.parameters.normalMap?(q=THREE.ShaderUtils.lib.normal,$=THREE.UniformsUtils.clone(q.uniforms),n=r.parameters.color,B=r.parameters.specular,fa=r.parameters.ambient,p=r.parameters.shininess,$.tNormal.value=M.textures[r.parameters.normalMap],
|
|
|
+n.anisotropy);if(n.repeat&&(B.repeat.set(n.repeat[0],n.repeat[1]),1!==n.repeat[0]&&(B.wrapS=THREE.RepeatWrapping),1!==n.repeat[1]))B.wrapT=THREE.RepeatWrapping;n.offset&&B.offset.set(n.offset[0],n.offset[1]);if(n.wrap&&(fa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==fa[n.wrap[0]]&&(B.wrapS=fa[n.wrap[0]]),void 0!==fa[n.wrap[1]]))B.wrapT=fa[n.wrap[1]]}M.textures[q]=B}for(o in R.materials){r=R.materials[o];for(u in r.parameters)"envMap"===u||"map"===u||"lightMap"===u||
|
|
|
+"bumpMap"===u?r.parameters[u]=M.textures[r.parameters[u]]:"shading"===u?r.parameters[u]="flat"===r.parameters[u]?THREE.FlatShading:THREE.SmoothShading:"side"===u?r.parameters[u]="double"==r.parameters[u]?THREE.DoubleSide:"back"==r.parameters[u]?THREE.BackSide:THREE.FrontSide:"blending"===u?r.parameters[u]=r.parameters[u]in THREE?THREE[r.parameters[u]]:THREE.NormalBlending:"combine"===u?r.parameters[u]="MixOperation"==r.parameters[u]?THREE.MixOperation:THREE.MultiplyOperation:"vertexColors"===u?"face"==
|
|
|
+r.parameters[u]?r.parameters[u]=THREE.FaceColors:r.parameters[u]&&(r.parameters[u]=THREE.VertexColors):"wrapRGB"===u&&(q=r.parameters[u],r.parameters[u]=new THREE.Vector3(q[0],q[1],q[2]));void 0!==r.parameters.opacity&&1>r.parameters.opacity&&(r.parameters.transparent=!0);r.parameters.normalMap?(q=THREE.ShaderUtils.lib.normal,$=THREE.UniformsUtils.clone(q.uniforms),n=r.parameters.color,B=r.parameters.specular,fa=r.parameters.ambient,p=r.parameters.shininess,$.tNormal.value=M.textures[r.parameters.normalMap],
|
|
|
r.parameters.normalScale&&$.uNormalScale.value.set(r.parameters.normalScale[0],r.parameters.normalScale[1]),r.parameters.map&&($.tDiffuse.value=r.parameters.map,$.enableDiffuse.value=!0),r.parameters.envMap&&($.tCube.value=r.parameters.envMap,$.enableReflection.value=!0,$.uReflectivity.value=r.parameters.reflectivity),r.parameters.lightMap&&($.tAO.value=r.parameters.lightMap,$.enableAO.value=!0),r.parameters.specularMap&&($.tSpecular.value=M.textures[r.parameters.specularMap],$.enableSpecular.value=
|
|
|
!0),r.parameters.displacementMap&&($.tDisplacement.value=M.textures[r.parameters.displacementMap],$.enableDisplacement.value=!0,$.uDisplacementBias.value=r.parameters.displacementBias,$.uDisplacementScale.value=r.parameters.displacementScale),$.uDiffuseColor.value.setHex(n),$.uSpecularColor.value.setHex(B),$.uAmbientColor.value.setHex(fa),$.uShininess.value=p,r.parameters.opacity&&($.uOpacity.value=r.parameters.opacity),A=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,
|
|
|
-uniforms:$,lights:!0,fog:!0})):A=new THREE[r.type](r.parameters);M.materials[o]=A}for(o in R.materials)if(r=R.materials[o],r.parameters.materials){y=[];for(B=0;B<r.parameters.materials.length;B++)y.push(M.materials[r.parameters.materials[B]]);M.materials[o].materials=y}e();M.cameras&&R.defaults.camera&&(M.currentCamera=M.cameras[R.defaults.camera]);M.fogs&&R.defaults.fog&&(M.scene.fog=M.fogs[R.defaults.fog]);u=R.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(u[0],u[1],u[2]);M.bgColorAlpha=
|
|
|
+uniforms:$,lights:!0,fog:!0})):A=new THREE[r.type](r.parameters);M.materials[o]=A}for(o in R.materials)if(r=R.materials[o],r.parameters.materials){u=[];for(B=0;B<r.parameters.materials.length;B++)u.push(M.materials[r.parameters.materials[B]]);M.materials[o].materials=u}e();M.cameras&&R.defaults.camera&&(M.currentCamera=M.cameras[R.defaults.camera]);M.fogs&&R.defaults.fog&&(M.scene.fog=M.fogs[R.defaults.fog]);v=R.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(v[0],v[1],v[2]);M.bgColorAlpha=
|
|
|
R.defaults.bgalpha;l.callbackSync(M);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
|
THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};
|
|
|
THREE.Material=function(){THREE.MaterialLibrary.push(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
@@ -227,6 +227,11 @@ THREE.ParticleCanvasMaterial.prototype.clone=function(){var a=new THREE.Particle
|
|
|
THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
|
THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=
|
|
|
this.morphTargets;a.morphNormals=this.morphNormals;return a};
|
|
|
+THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=new THREE.Texture;this.useScreenCoordinates=!0;this.mergeWith3D=!this.useScreenCoordinates;this.affectedByDistance=!this.useScreenCoordinates;this.scaleByViewport=!this.affectedByDistance;this.alignment=THREE.SpriteAlignment.center.clone();this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a);a=a||{};void 0===a.mergeWith3D&&(this.mergeWith3D=!this.useScreenCoordinates);
|
|
|
+void 0===a.affectedByDistance&&(this.affectedByDistance=!this.useScreenCoordinates);void 0===a.scaleByViewport&&(this.scaleByViewport=!this.affectedByDistance)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
|
+THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.useScreenCoordinates=this.useScreenCoordinates;a.mergeWith3D=this.mergeWith3D;a.affectedByDistance=this.affectedByDistance;a.scaleByViewport=this.scaleByViewport;a.alignment.copy(this.alignment);a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);a.fog=this.fog;return a};THREE.SpriteAlignment={};
|
|
|
+THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);
|
|
|
+THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
|
|
|
THREE.Texture=function(a,b,c,d,e,f,g,h,i){THREE.TextureLibrary.push(this);this.id=THREE.TextureIdCount++;this.name="";this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;
|
|
|
this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.needsUpdate=!1;this.onUpdate=null};
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture;a.image=this.image;a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;return a},deallocate:function(){var a=THREE.TextureLibrary.indexOf(this);
|
|
@@ -256,29 +261,25 @@ THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/th
|
|
|
THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Ribbon.prototype.clone=function(a){void 0===a&&(a=new THREE.Ribbon(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length&&!(b<this.LODs[c].visibleAtDistance);c++);this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
|
|
|
THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=
|
|
|
-!1}};THREE.LOD.prototype.clone=function(){};
|
|
|
-THREE.Sprite=function(a){THREE.Object3D.call(this);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=void 0!==
|
|
|
-a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center.clone();this.fog=void 0!==a.fog?a.fog:!1;this.rotation3d=this.rotation;this.rotation=
|
|
|
-0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.alphaTest=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};
|
|
|
-THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite({}));a.color.copy(this.color);a.map=this.map;a.blending=this.blending;a.useScreenCoordinates=this.useScreenCoordinates;a.mergeWith3D=this.mergeWith3D;a.affectedByDistance=this.affectedByDistance;a.scaleByViewport=this.scaleByViewport;a.alignment=this.alignment;a.fog=this.fog;a.rotation3d.copy(this.rotation3d);a.rotation=this.rotation;a.opacity=this.opacity;a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);THREE.Object3D.prototype.clone.call(this,
|
|
|
-a);return a};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);
|
|
|
-THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+!1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};
|
|
|
+THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){C!==a&&(C=q.globalAlpha=a)}function c(a){w!==a&&(a===THREE.NormalBlending?q.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?q.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(q.globalCompositeOperation="darker"),w=a)}function d(a){s!==a&&(s=q.strokeStyle=a)}function e(a){H!==a&&(H=q.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
|
|
|
-document.createElement("canvas"),m,n,o,p,q=l.getContext("2d"),t=new THREE.Color(0),r=0,C=1,w=0,s=null,H=null,z=null,u=null,y=null,D,A,I,J,B=new THREE.RenderableVertex,K=new THREE.RenderableVertex,F,L,P,N,Q,S,M,O,R,$,fa,Ha,G=new THREE.Color,ba=new THREE.Color,ha=new THREE.Color,Y=new THREE.Color,ia=new THREE.Color,ca=new THREE.Color,aa=new THREE.Color,na={},eb={},La,ya,pa,Ra,fb,ub,qb,mb,lb,$b,pb=new THREE.Rectangle,Sa=new THREE.Rectangle,qa=new THREE.Rectangle,nb=!1,ka=new THREE.Color,rb=new THREE.Color,
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){C!==a&&(C=q.globalAlpha=a)}function c(a){y!==a&&(a===THREE.NormalBlending?q.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?q.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(q.globalCompositeOperation="darker"),y=a)}function d(a){s!==a&&(s=q.strokeStyle=a)}function e(a){H!==a&&(H=q.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
|
|
|
+document.createElement("canvas"),m,n,o,p,q=l.getContext("2d"),t=new THREE.Color(0),r=0,C=1,y=0,s=null,H=null,z=null,v=null,u=null,D,A,I,J,B=new THREE.RenderableVertex,K=new THREE.RenderableVertex,F,L,P,N,Q,S,M,O,R,$,fa,Ha,G=new THREE.Color,ba=new THREE.Color,ha=new THREE.Color,Y=new THREE.Color,ia=new THREE.Color,ca=new THREE.Color,aa=new THREE.Color,na={},eb={},La,ya,pa,Ra,fb,ub,qb,mb,lb,$b,pb=new THREE.Rectangle,Sa=new THREE.Rectangle,qa=new THREE.Rectangle,nb=!1,ka=new THREE.Color,rb=new THREE.Color,
|
|
|
gb=new THREE.Color,Aa=new THREE.Vector3,sb,Va,vb,Wa,ab,cb,a=16;sb=document.createElement("canvas");sb.width=sb.height=2;Va=sb.getContext("2d");Va.fillStyle="rgba(0,0,0,1)";Va.fillRect(0,0,2,2);vb=Va.getImageData(0,0,2,2);Wa=vb.data;ab=document.createElement("canvas");ab.width=ab.height=a;cb=ab.getContext("2d");cb.translate(-a/2,-a/2);cb.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;n=b;o=
|
|
|
-Math.floor(m/2);p=Math.floor(n/2);l.width=m;l.height=n;pb.set(-o,-p,o,p);Sa.set(-o,-p,o,p);C=1;w=0;y=u=z=H=s=null};this.setClearColor=function(a,b){t.copy(a);r=void 0!==b?b:1;Sa.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){t.setHex(a);r=void 0!==b?b:1;Sa.set(-o,-p,o,p)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){q.setTransform(1,0,0,-1,o,p);!1===Sa.isEmpty()&&(Sa.minSelf(pb),Sa.inflate(2),1>r&&q.clearRect(Math.floor(Sa.getX()),Math.floor(Sa.getY()),Math.floor(Sa.getWidth()),
|
|
|
+Math.floor(m/2);p=Math.floor(n/2);l.width=m;l.height=n;pb.set(-o,-p,o,p);Sa.set(-o,-p,o,p);C=1;y=0;u=v=z=H=s=null};this.setClearColor=function(a,b){t.copy(a);r=void 0!==b?b:1;Sa.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){t.setHex(a);r=void 0!==b?b:1;Sa.set(-o,-p,o,p)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){q.setTransform(1,0,0,-1,o,p);!1===Sa.isEmpty()&&(Sa.minSelf(pb),Sa.inflate(2),1>r&&q.clearRect(Math.floor(Sa.getX()),Math.floor(Sa.getY()),Math.floor(Sa.getWidth()),
|
|
|
Math.floor(Sa.getHeight())),0<r&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*t.r)+","+Math.floor(255*t.g)+","+Math.floor(255*t.b)+","+r+")"),q.fillRect(Math.floor(Sa.getX()),Math.floor(Sa.getY()),Math.floor(Sa.getWidth()),Math.floor(Sa.getHeight()))),Sa.empty())};this.render=function(a,l){function n(a,b,c){for(var d=0,e=i.length;d<e;d++){var f=i[d],g=f.color;if(f instanceof THREE.DirectionalLight){var h=f.matrixWorld.getPosition().normalize(),k=b.dot(h);0>=k||(k*=f.intensity,c.r+=g.r*k,
|
|
|
c.g+=g.g*k,c.b+=g.b*k)}else f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),k=b.dot(Aa.sub(h,a).normalize()),0>=k||(k*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=k&&(k*=f.intensity,c.r+=g.r*k,c.g+=g.g*k,c.b+=g.b*k)))}}function k(a,d,e,g,h,k,i,j){f.info.render.vertices+=3;f.info.render.faces++;b(j.opacity);c(j.blending);F=a.positionScreen.x;L=a.positionScreen.y;P=d.positionScreen.x;N=d.positionScreen.y;Q=e.positionScreen.x;S=e.positionScreen.y;m(F,L,P,N,Q,S);(j instanceof
|
|
|
THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)&&null===j.map&&null===j.map?(ca.copy(j.color),aa.copy(j.emissive),j.vertexColors===THREE.FaceColors&&(ca.r*=i.color.r,ca.g*=i.color.g,ca.b*=i.color.b),!0===nb)?!1===j.wireframe&&j.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(ba.r=ha.r=Y.r=ka.r,ba.g=ha.g=Y.g=ka.g,ba.b=ha.b=Y.b=ka.b,n(i.v1.positionWorld,i.vertexNormalsWorld[0],ba),n(i.v2.positionWorld,i.vertexNormalsWorld[1],ha),n(i.v3.positionWorld,i.vertexNormalsWorld[2],
|
|
|
Y),ba.r=ba.r*ca.r+aa.r,ba.g=ba.g*ca.g+aa.g,ba.b=ba.b*ca.b+aa.b,ha.r=ha.r*ca.r+aa.r,ha.g=ha.g*ca.g+aa.g,ha.b=ha.b*ca.b+aa.b,Y.r=Y.r*ca.r+aa.r,Y.g=Y.g*ca.g+aa.g,Y.b=Y.b*ca.b+aa.b,ia.r=0.5*(ha.r+Y.r),ia.g=0.5*(ha.g+Y.g),ia.b=0.5*(ha.b+Y.b),pa=H(ba,ha,Y,ia),C(F,L,P,N,Q,S,0,0,1,0,0,1,pa)):(G.r=ka.r,G.g=ka.g,G.b=ka.b,n(i.centroidWorld,i.normalWorld,G),G.r=G.r*ca.r+aa.r,G.g=G.g*ca.g+aa.g,G.b=G.b*ca.b+aa.b,!0===j.wireframe?s(G,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):t(G)):!0===j.wireframe?
|
|
|
-s(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):t(j.color):j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial?null!==j.map?j.map.mapping instanceof THREE.UVMapping&&(Ra=i.uvs[0],w(F,L,P,N,Q,S,Ra[g].u,Ra[g].v,Ra[h].u,Ra[h].v,Ra[k].u,Ra[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,Aa.copy(i.vertexNormalsWorld[g]),fb=0.5*(Aa.x*a.elements[0]+Aa.y*
|
|
|
-a.elements[4]+Aa.z*a.elements[8])+0.5,ub=0.5*(Aa.x*a.elements[1]+Aa.y*a.elements[5]+Aa.z*a.elements[9])+0.5,Aa.copy(i.vertexNormalsWorld[h]),qb=0.5*(Aa.x*a.elements[0]+Aa.y*a.elements[4]+Aa.z*a.elements[8])+0.5,mb=0.5*(Aa.x*a.elements[1]+Aa.y*a.elements[5]+Aa.z*a.elements[9])+0.5,Aa.copy(i.vertexNormalsWorld[k]),lb=0.5*(Aa.x*a.elements[0]+Aa.y*a.elements[4]+Aa.z*a.elements[8])+0.5,$b=0.5*(Aa.x*a.elements[1]+Aa.y*a.elements[5]+Aa.z*a.elements[9])+0.5,w(F,L,P,N,Q,S,fb,ub,qb,mb,lb,$b,j.envMap)):(G.copy(j.color),
|
|
|
+s(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):t(j.color):j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial?null!==j.map?j.map.mapping instanceof THREE.UVMapping&&(Ra=i.uvs[0],y(F,L,P,N,Q,S,Ra[g].u,Ra[g].v,Ra[h].u,Ra[h].v,Ra[k].u,Ra[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,Aa.copy(i.vertexNormalsWorld[g]),fb=0.5*(Aa.x*a.elements[0]+Aa.y*
|
|
|
+a.elements[4]+Aa.z*a.elements[8])+0.5,ub=0.5*(Aa.x*a.elements[1]+Aa.y*a.elements[5]+Aa.z*a.elements[9])+0.5,Aa.copy(i.vertexNormalsWorld[h]),qb=0.5*(Aa.x*a.elements[0]+Aa.y*a.elements[4]+Aa.z*a.elements[8])+0.5,mb=0.5*(Aa.x*a.elements[1]+Aa.y*a.elements[5]+Aa.z*a.elements[9])+0.5,Aa.copy(i.vertexNormalsWorld[k]),lb=0.5*(Aa.x*a.elements[0]+Aa.y*a.elements[4]+Aa.z*a.elements[8])+0.5,$b=0.5*(Aa.x*a.elements[1]+Aa.y*a.elements[5]+Aa.z*a.elements[9])+0.5,y(F,L,P,N,Q,S,fb,ub,qb,mb,lb,$b,j.envMap)):(G.copy(j.color),
|
|
|
j.vertexColors===THREE.FaceColors&&(G.r*=i.color.r,G.g*=i.color.g,G.b*=i.color.b),!0===j.wireframe?s(G,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):t(G)):j instanceof THREE.MeshDepthMaterial?(La=l.near,ya=l.far,ba.r=ba.g=ba.b=1-Xa(a.positionScreen.z,La,ya),ha.r=ha.g=ha.b=1-Xa(d.positionScreen.z,La,ya),Y.r=Y.g=Y.b=1-Xa(e.positionScreen.z,La,ya),ia.r=0.5*(ha.r+Y.r),ia.g=0.5*(ha.g+Y.g),ia.b=0.5*(ha.b+Y.b),pa=H(ba,ha,Y,ia),C(F,L,P,N,Q,S,0,0,1,0,0,1,pa)):j instanceof THREE.MeshNormalMaterial&&
|
|
|
-(G.r=Ya(i.normalWorld.x),G.g=Ya(i.normalWorld.y),G.b=Ya(i.normalWorld.z),!0===j.wireframe?s(G,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):t(G))}function m(a,b,c,d,e,f){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.closePath()}function r(a,b,c,d,e,f,g,h){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.lineTo(g,h);q.closePath()}function s(a,b,c,e){z!==b&&(z=q.lineWidth=b);u!==c&&(u=q.lineCap=c);y!==e&&(y=q.lineJoin=e);d(a.getContextStyle());q.stroke();qa.inflate(2*
|
|
|
-b)}function t(a){e(a.getContextStyle());q.fill()}function w(a,b,c,d,f,g,h,i,k,j,l,Ya,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var m=n.wrapS==THREE.RepeatWrapping,hb=n.wrapT==THREE.RepeatWrapping;na[n.id]=q.createPattern(n.image,!0===m&&!0===hb?"repeat":!0===m&&!1===hb?"repeat-x":!1===m&&!0===hb?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===na[n.id]?e("rgba(0,0,0,1)"):e(na[n.id]);var m=n.offset.x/n.repeat.x,hb=n.offset.y/n.repeat.y,o=n.image.width*
|
|
|
+(G.r=Ya(i.normalWorld.x),G.g=Ya(i.normalWorld.y),G.b=Ya(i.normalWorld.z),!0===j.wireframe?s(G,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):t(G))}function m(a,b,c,d,e,f){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.closePath()}function r(a,b,c,d,e,f,g,h){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.lineTo(g,h);q.closePath()}function s(a,b,c,e){z!==b&&(z=q.lineWidth=b);v!==c&&(v=q.lineCap=c);u!==e&&(u=q.lineJoin=e);d(a.getContextStyle());q.stroke();qa.inflate(2*
|
|
|
+b)}function t(a){e(a.getContextStyle());q.fill()}function y(a,b,c,d,f,g,h,i,k,j,l,Ya,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var m=n.wrapS==THREE.RepeatWrapping,hb=n.wrapT==THREE.RepeatWrapping;na[n.id]=q.createPattern(n.image,!0===m&&!0===hb?"repeat":!0===m&&!1===hb?"repeat-x":!1===m&&!0===hb?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===na[n.id]?e("rgba(0,0,0,1)"):e(na[n.id]);var m=n.offset.x/n.repeat.x,hb=n.offset.y/n.repeat.y,o=n.image.width*
|
|
|
n.repeat.x,p=n.image.height*n.repeat.y,h=(h+m)*o,i=(1-i+hb)*p,c=c-a,d=d-b,f=f-a,g=g-b,k=(k+m)*o-h,j=(1-j+hb)*p-i,l=(l+m)*o-h,Ya=(1-Ya+hb)*p-i,m=k*Ya-l*j;0===m?(void 0===eb[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),eb[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=eb[n.id],h=4*(Math.floor(h)+Math.floor(i)*n.image.width),G.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255),t(G)):(m=1/m,n=(Ya*c-j*f)*m,j=
|
|
|
(Ya*d-j*g)*m,c=(k*f-l*c)*m,d=(k*g-l*d)*m,a=a-n*h-c*i,h=b-j*h-d*i,q.save(),q.transform(n,j,c,d,a,h),q.fill(),q.restore())}}function C(a,b,c,d,e,f,g,h,i,k,j,l,n){var Ya,m;Ya=n.width-1;m=n.height-1;g*=Ya;h*=m;c-=a;d-=b;e-=a;f-=b;i=i*Ya-g;k=k*m-h;j=j*Ya-g;l=l*m-h;m=1/(i*l-j*k);Ya=(l*c-k*e)*m;k=(l*d-k*f)*m;c=(i*e-j*c)*m;d=(i*f-j*d)*m;a=a-Ya*g-c*h;b=b-k*g-d*h;q.save();q.transform(Ya,k,c,d,a,b);q.clip();q.drawImage(n,0,0);q.restore()}function H(a,b,c,d){Wa[0]=255*a.r|0;Wa[1]=255*a.g|0;Wa[2]=255*a.b|0;Wa[4]=
|
|
|
255*b.r|0;Wa[5]=255*b.g|0;Wa[6]=255*b.b|0;Wa[8]=255*c.r|0;Wa[9]=255*c.g|0;Wa[10]=255*c.b|0;Wa[12]=255*d.r|0;Wa[13]=255*d.g|0;Wa[14]=255*d.b|0;Va.putImageData(vb,0,0);cb.drawImage(sb,0,0);return ab}function Xa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ya(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function ac(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===l instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
@@ -286,7 +287,7 @@ else{var hb,yc,la,da;!0===this.autoClear?this.clear():q.setTransform(1,0,0,-1,o,
|
|
|
(gb.r+=ma.r,gb.g+=ma.g,gb.b+=ma.b)}}hb=0;for(yc=h.length;hb<yc;hb++)if(la=h[hb],da=la.material,!(void 0===da||!1===da.visible)){qa.empty();if(la instanceof THREE.RenderableParticle){D=la;D.x*=o;D.y*=p;var ma=D,bb=la;b(da.opacity);c(da.blending);var Eb=void 0,Fb=void 0,wb=void 0,xb=void 0,ic=la=void 0,Qc=void 0;da instanceof THREE.ParticleBasicMaterial?null===da.map?(wb=bb.object.scale.x,xb=bb.object.scale.y,wb*=bb.scale.x*o,xb*=bb.scale.y*p,qa.set(ma.x-wb,ma.y-xb,ma.x+wb,ma.y+xb),!1!==pb.intersects(qa)&&
|
|
|
(e(da.color.getContextStyle()),q.save(),q.translate(ma.x,ma.y),q.rotate(-bb.rotation),q.scale(wb,xb),q.fillRect(-1,-1,2,2),q.restore())):(la=da.map.image,ic=la.width>>1,Qc=la.height>>1,wb=bb.scale.x*o,xb=bb.scale.y*p,Eb=wb*ic,Fb=xb*Qc,qa.set(ma.x-Eb,ma.y-Fb,ma.x+Eb,ma.y+Fb),!1!==pb.intersects(qa)&&(q.save(),q.translate(ma.x,ma.y),q.rotate(-bb.rotation),q.scale(wb,-xb),q.translate(-ic,-Qc),q.drawImage(la,0,0),q.restore())):da instanceof THREE.ParticleCanvasMaterial&&(Eb=bb.scale.x*o,Fb=bb.scale.y*
|
|
|
p,qa.set(ma.x-Eb,ma.y-Fb,ma.x+Eb,ma.y+Fb),!1!==pb.intersects(qa)&&(d(da.color.getContextStyle()),e(da.color.getContextStyle()),q.save(),q.translate(ma.x,ma.y),q.rotate(-bb.rotation),q.scale(Eb,Fb),da.program(q),q.restore()))}else if(la instanceof THREE.RenderableLine){if(D=la.v1,A=la.v2,D.positionScreen.x*=o,D.positionScreen.y*=p,A.positionScreen.x*=o,A.positionScreen.y*=p,qa.addPoint(D.positionScreen.x,D.positionScreen.y),qa.addPoint(A.positionScreen.x,A.positionScreen.y),!0===pb.intersects(qa)&&
|
|
|
-(ma=D,bb=A,b(da.opacity),c(da.blending),q.beginPath(),q.moveTo(ma.positionScreen.x,ma.positionScreen.y),q.lineTo(bb.positionScreen.x,bb.positionScreen.y),da instanceof THREE.LineBasicMaterial))ma=da.linewidth,z!==ma&&(z=q.lineWidth=ma),ma=da.linecap,u!==ma&&(u=q.lineCap=ma),ma=da.linejoin,y!==ma&&(y=q.lineJoin=ma),d(da.color.getContextStyle()),q.stroke(),qa.inflate(2*da.linewidth)}else if(la instanceof THREE.RenderableFace3)D=la.v1,A=la.v2,I=la.v3,D.positionScreen.x*=o,D.positionScreen.y*=p,A.positionScreen.x*=
|
|
|
+(ma=D,bb=A,b(da.opacity),c(da.blending),q.beginPath(),q.moveTo(ma.positionScreen.x,ma.positionScreen.y),q.lineTo(bb.positionScreen.x,bb.positionScreen.y),da instanceof THREE.LineBasicMaterial))ma=da.linewidth,z!==ma&&(z=q.lineWidth=ma),ma=da.linecap,v!==ma&&(v=q.lineCap=ma),ma=da.linejoin,u!==ma&&(u=q.lineJoin=ma),d(da.color.getContextStyle()),q.stroke(),qa.inflate(2*da.linewidth)}else if(la instanceof THREE.RenderableFace3)D=la.v1,A=la.v2,I=la.v3,D.positionScreen.x*=o,D.positionScreen.y*=p,A.positionScreen.x*=
|
|
|
o,A.positionScreen.y*=p,I.positionScreen.x*=o,I.positionScreen.y*=p,!0===da.overdraw&&(ac(D.positionScreen,A.positionScreen),ac(A.positionScreen,I.positionScreen),ac(I.positionScreen,D.positionScreen)),qa.add3Points(D.positionScreen.x,D.positionScreen.y,A.positionScreen.x,A.positionScreen.y,I.positionScreen.x,I.positionScreen.y),!0===pb.intersects(qa)&&k(D,A,I,0,1,2,la,da,a);else if(la instanceof THREE.RenderableFace4&&(D=la.v1,A=la.v2,I=la.v3,J=la.v4,D.positionScreen.x*=o,D.positionScreen.y*=p,A.positionScreen.x*=
|
|
|
o,A.positionScreen.y*=p,I.positionScreen.x*=o,I.positionScreen.y*=p,J.positionScreen.x*=o,J.positionScreen.y*=p,B.positionScreen.copy(A.positionScreen),K.positionScreen.copy(J.positionScreen),!0===da.overdraw&&(ac(D.positionScreen,A.positionScreen),ac(A.positionScreen,J.positionScreen),ac(J.positionScreen,D.positionScreen),ac(I.positionScreen,B.positionScreen),ac(I.positionScreen,K.positionScreen)),qa.addPoint(D.positionScreen.x,D.positionScreen.y),qa.addPoint(A.positionScreen.x,A.positionScreen.y),
|
|
|
qa.addPoint(I.positionScreen.x,I.positionScreen.y),qa.addPoint(J.positionScreen.x,J.positionScreen.y),!0===pb.intersects(qa)))(ma=D,bb=A,Eb=I,Fb=J,wb=B,xb=K,ic=a,f.info.render.vertices+=4,f.info.render.faces++,b(da.opacity),c(da.blending),void 0!==da.map&&null!==da.map||void 0!==da.envMap&&null!==da.envMap)?(k(ma,bb,Fb,0,1,3,la,da,ic),k(wb,Eb,xb,1,2,3,la,da,ic)):(F=ma.positionScreen.x,L=ma.positionScreen.y,P=bb.positionScreen.x,N=bb.positionScreen.y,Q=Eb.positionScreen.x,S=Eb.positionScreen.y,M=Fb.positionScreen.x,
|
|
@@ -354,13 +355,13 @@ h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function j(a,b,c){var d=a.attr
|
|
|
a.uvsNeedUpdate&&void 0!==h&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(k.bindBuffer(k.ARRAY_BUFFER,i.buffer),k.bufferData(k.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(k.bindBuffer(k.ARRAY_BUFFER,d.buffer),k.bufferData(k.ARRAY_BUFFER,d.array,b));if(c)for(var j in a.attributes)delete a.attributes[j].array}function l(a){Va[a]||(k.enableVertexAttribArray(a),Va[a]=!0)}function m(){for(var a in Va)Va[a]&&(k.disableVertexAttribArray(a),
|
|
|
Va[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function o(a,b){return b[1]-a[1]}function p(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)na=Y=null,ca=aa=pa=ya=lb=mb=Ra=-1,Cb=!0,a[d].render(b,c,Aa,sb),na=Y=null,ca=aa=pa=ya=lb=mb=Ra=-1,Cb=!0}function q(a,b,c,d,e,f,g,h){var i,k,j,l;b?(k=a.length-1,l=b=-1):(k=0,b=a.length,l=1);for(var n=k;n!==b;n+=l)if(i=a[n],i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&G.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);
|
|
|
G.setDepthTest(i.depthTest);G.setDepthWrite(i.depthWrite);I(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}G.setMaterialFaces(i);j instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,i,j,k):G.renderBuffer(d,e,f,i,j,k)}}function t(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);I(h.polygonOffset,
|
|
|
-h.polygonOffsetFactor,h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,i)}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function s(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function H(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function z(a,b,c,d,e){La=0;d.needsUpdate&&
|
|
|
-(d.program&&G.deallocateMaterial(d),G.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Y&&(k.useProgram(g),Y=g,f=!0);d.id!==ca&&(ca=d.id,f=!0);if(f||a!==na)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==na&&(na=a);if(d.skinning)if(Xa&&e.useVertexTexture){if(null!==h.boneTexture){var j=u();k.uniform1i(h.boneTexture,j);
|
|
|
-G.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Cb){for(var l=0,n=0,m=0,o,p,q,r=wc,s=r.directional.colors,t=r.directional.positions,w=r.point.colors,y=r.point.positions,
|
|
|
+h.polygonOffsetFactor,h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,i)}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function y(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function s(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function H(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function z(a,b,c,d,e){La=0;d.needsUpdate&&
|
|
|
+(d.program&&G.deallocateMaterial(d),G.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Y&&(k.useProgram(g),Y=g,f=!0);d.id!==ca&&(ca=d.id,f=!0);if(f||a!==na)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==na&&(na=a);if(d.skinning)if(Xa&&e.useVertexTexture){if(null!==h.boneTexture){var j=v();k.uniform1i(h.boneTexture,j);
|
|
|
+G.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Cb){for(var l=0,n=0,m=0,o,p,q,r=wc,s=r.directional.colors,t=r.directional.positions,u=r.point.colors,y=r.point.positions,
|
|
|
z=r.point.distances,C=r.spot.colors,B=r.spot.positions,H=r.spot.distances,F=r.spot.directions,I=r.spot.anglesCos,O=r.spot.exponents,L=r.hemi.skyColors,ba=r.hemi.groundColors,J=r.hemi.positions,M=0,aa=0,R=0,Q=0,ha=0,$=0,fa=0,ia=0,S=p=0,c=S=S=0,f=b.length;c<f;c++)j=b[c],j.onlyShadow||(o=j.color,q=j.intensity,p=j.distance,j instanceof THREE.AmbientLight?j.visible&&(G.gammaInput?(l+=o.r*o.r,n+=o.g*o.g,m+=o.b*o.b):(l+=o.r,n+=o.g,m+=o.b)):j instanceof THREE.DirectionalLight?(ha+=1,j.visible&&(p=3*M,G.gammaInput?
|
|
|
-D(s,p,o,q*q):A(s,p,o,q),za.copy(j.matrixWorld.getPosition()),za.subSelf(j.target.matrixWorld.getPosition()),za.normalize(),t[p]=za.x,t[p+1]=za.y,t[p+2]=za.z,M+=1)):j instanceof THREE.PointLight?($+=1,j.visible&&(S=3*aa,G.gammaInput?D(w,S,o,q*q):A(w,S,o,q),q=j.matrixWorld.getPosition(),y[S]=q.x,y[S+1]=q.y,y[S+2]=q.z,z[aa]=p,aa+=1)):j instanceof THREE.SpotLight?(fa+=1,j.visible&&(S=3*R,G.gammaInput?D(C,S,o,q*q):A(C,S,o,q),q=j.matrixWorld.getPosition(),B[S]=q.x,B[S+1]=q.y,B[S+2]=q.z,H[R]=p,za.copy(q),
|
|
|
+D(s,p,o,q*q):A(s,p,o,q),za.copy(j.matrixWorld.getPosition()),za.subSelf(j.target.matrixWorld.getPosition()),za.normalize(),t[p]=za.x,t[p+1]=za.y,t[p+2]=za.z,M+=1)):j instanceof THREE.PointLight?($+=1,j.visible&&(S=3*aa,G.gammaInput?D(u,S,o,q*q):A(u,S,o,q),q=j.matrixWorld.getPosition(),y[S]=q.x,y[S+1]=q.y,y[S+2]=q.z,z[aa]=p,aa+=1)):j instanceof THREE.SpotLight?(fa+=1,j.visible&&(S=3*R,G.gammaInput?D(C,S,o,q*q):A(C,S,o,q),q=j.matrixWorld.getPosition(),B[S]=q.x,B[S+1]=q.y,B[S+2]=q.z,H[R]=p,za.copy(q),
|
|
|
za.subSelf(j.target.matrixWorld.getPosition()),za.normalize(),F[S]=za.x,F[S+1]=za.y,F[S+2]=za.z,I[R]=Math.cos(j.angle),O[R]=j.exponent,R+=1)):j instanceof THREE.HemisphereLight&&(ia+=1,j.visible&&(o=j.color,p=j.groundColor,S=3*Q,G.gammaInput?(q*=q,D(L,S,o,q),D(ba,S,p,q)):(A(L,S,o,q),A(ba,S,p,q)),za.copy(j.matrixWorld.getPosition()),za.normalize(),J[S]=za.x,J[S+1]=za.y,J[S+2]=za.z,Q+=1)));c=3*M;for(f=Math.max(s.length,3*ha);c<f;c++)s[c]=0;c=3*M;for(f=Math.max(t.length,3*ha);c<f;c++)t[c]=0;c=3*aa;for(f=
|
|
|
-Math.max(w.length,3*$);c<f;c++)w[c]=0;c=3*aa;for(f=Math.max(y.length,3*$);c<f;c++)y[c]=0;c=aa;for(f=Math.max(z.length,$);c<f;c++)z[c]=0;c=3*R;for(f=Math.max(C.length,3*fa);c<f;c++)C[c]=0;c=3*R;for(f=Math.max(B.length,3*fa);c<f;c++)B[c]=0;c=3*R;for(f=Math.max(F.length,3*fa);c<f;c++)F[c]=0;c=R;for(f=Math.max(I.length,fa);c<f;c++)I[c]=0;c=R;for(f=Math.max(O.length,fa);c<f;c++)O[c]=0;c=R;for(f=Math.max(H.length,fa);c<f;c++)H[c]=0;c=3*Q;for(f=Math.max(L.length,3*ia);c<f;c++)L[c]=0;c=3*Q;for(f=Math.max(ba.length,
|
|
|
+Math.max(u.length,3*$);c<f;c++)u[c]=0;c=3*aa;for(f=Math.max(y.length,3*$);c<f;c++)y[c]=0;c=aa;for(f=Math.max(z.length,$);c<f;c++)z[c]=0;c=3*R;for(f=Math.max(C.length,3*fa);c<f;c++)C[c]=0;c=3*R;for(f=Math.max(B.length,3*fa);c<f;c++)B[c]=0;c=3*R;for(f=Math.max(F.length,3*fa);c<f;c++)F[c]=0;c=R;for(f=Math.max(I.length,fa);c<f;c++)I[c]=0;c=R;for(f=Math.max(O.length,fa);c<f;c++)O[c]=0;c=R;for(f=Math.max(H.length,fa);c<f;c++)H[c]=0;c=3*Q;for(f=Math.max(L.length,3*ia);c<f;c++)L[c]=0;c=3*Q;for(f=Math.max(ba.length,
|
|
|
3*ia);c<f;c++)ba[c]=0;c=3*Q;for(f=Math.max(J.length,3*ia);c<f;c++)J[c]=0;r.directional.length=M;r.point.length=aa;r.spot.length=R;r.hemi.length=Q;r.ambient[0]=l;r.ambient[1]=n;r.ambient[2]=m;Cb=!1}c=wc;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;
|
|
|
i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
|
|
|
d.opacity;G.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var U;d.map?U=d.map:d.specularMap?U=d.specularMap:d.normalMap?U=d.normalMap:d.bumpMap&&(U=d.bumpMap);void 0!==U&&(c=U.offset,U=U.repeat,i.offsetRepeat.value.set(c.x,c.y,U.x,U.y));
|
|
@@ -370,12 +371,12 @@ d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMat
|
|
|
i.shadowMatrix){c=U=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[U]=j.shadowMap,i.shadowMapSize.value[U]=j.shadowMapSize,i.shadowMatrix.value[U]=j.shadowMatrix,i.shadowDarkness.value[U]=j.shadowDarkness,i.shadowBias.value[U]=j.shadowBias,U++}b=d.uniformsList;i=0;for(U=b.length;i<U;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,j=c.value,"i"===l)k.uniform1i(f,j);else if("f"===l)k.uniform1f(f,
|
|
|
j);else if("v2"===l)k.uniform2f(f,j.x,j.y);else if("v3"===l)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===l)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===l)k.uniform3f(f,j.r,j.g,j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(n=j.length;l<n;l++)m=2*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===
|
|
|
l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(n=j.length;l<n;l++)m=3*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y,c._array[m+2]=j[l].z;k.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(n=j.length;l<n;l++)m=4*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y,c._array[m+2]=j[l].z,c._array[m+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),j.flattenToArray(c._array),k.uniformMatrix4fv(f,
|
|
|
-!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(c._array,16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(m=j,j=u(),k.uniform1i(f,j),m)if(m.image instanceof Array&&6===m.image.length){if(c=m,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture());k.activeTexture(k.TEXTURE0+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
|
-k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)G.autoScaleCubemaps&&!f?(n=j,m=l,r=c.image[l],t=Pc,r.width<=t&&r.height<=t||(w=Math.max(r.width,r.height),s=Math.floor(r.width*t/w),t=Math.floor(r.height*t/w),w=document.createElement("canvas"),w.width=s,w.height=t,w.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,s,t),r=w),n[m]=r):j[l]=c.image[l];l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);m=P(c.format);r=P(c.type);K(k.TEXTURE_CUBE_MAP,
|
|
|
-c,n);for(l=0;6>l;l++)if(f){t=j[l].mipmaps;w=0;for(y=t.length;w<y;w++)s=t[w],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,m,s.width,s.height,0,s.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m,m,r,j[l]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(c=m,k.activeTexture(k.TEXTURE0+
|
|
|
-j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):G.setTexture(m,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=u();k.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)m=c.value[l],j=c._array[l],m&&G.setTexture(m,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)b=a.matrixWorld.getPosition(),k.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||
|
|
|
-d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function u(){var a=La;a>=xc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+
|
|
|
-xc);La+=1;return a}function y(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}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 A(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function I(a,b,c){$b!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),$b=a);if(a&&(pb!==b||Sa!==c))k.polygonOffset(b,c),pb=b,Sa=c}function J(a){for(var a=a.split("\n"),b=0,c=a.length;b<
|
|
|
+!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(c._array,16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(m=j,j=v(),k.uniform1i(f,j),m)if(m.image instanceof Array&&6===m.image.length){if(c=m,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture());k.activeTexture(k.TEXTURE0+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
|
+k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)G.autoScaleCubemaps&&!f?(n=j,m=l,r=c.image[l],t=Pc,r.width<=t&&r.height<=t||(u=Math.max(r.width,r.height),s=Math.floor(r.width*t/u),t=Math.floor(r.height*t/u),u=document.createElement("canvas"),u.width=s,u.height=t,u.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,s,t),r=u),n[m]=r):j[l]=c.image[l];l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);m=P(c.format);r=P(c.type);K(k.TEXTURE_CUBE_MAP,
|
|
|
+c,n);for(l=0;6>l;l++)if(f){t=j[l].mipmaps;u=0;for(y=t.length;u<y;u++)s=t[u],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,u,m,s.width,s.height,0,s.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m,m,r,j[l]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(c=m,k.activeTexture(k.TEXTURE0+
|
|
|
+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):G.setTexture(m,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=v();k.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)m=c.value[l],j=c._array[l],m&&G.setTexture(m,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)b=a.matrixWorld.getPosition(),k.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||
|
|
|
+d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function v(){var a=La;a>=xc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+
|
|
|
+xc);La+=1;return a}function u(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}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 A(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function I(a,b,c){$b!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),$b=a);if(a&&(pb!==b||Sa!==c))k.polygonOffset(b,c),pb=b,Sa=c}function J(a){for(var a=a.split("\n"),b=0,c=a.length;b<
|
|
|
c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function B(a,b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(J(b)),null):c}function K(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,P(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,P(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,P(b.magFilter)),k.texParameteri(a,
|
|
|
k.TEXTURE_MIN_FILTER,P(b.minFilter))):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,L(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,L(b.minFilter)));if(Db&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,Db.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,nc)),b.__oldAnisotropy=b.anisotropy}function F(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?
|
|
|
(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function L(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
|
|
@@ -413,14 +414,14 @@ i],3,k.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[i]=0),i++}null!==d.program.u
|
|
|
k.vertexAttribPointer(b.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==qa&&(k.lineWidth(d),qa=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=e.__webglFaceCount,G.info.render.faces+=e.__webglFaceCount/
|
|
|
3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==qa&&(k.lineWidth(d),qa=d),k.drawArrays(f,0,e.__webglLineCount),G.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),G.info.render.calls++,G.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),G.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
else{var e,f,g,h,i=a.__lights,j=a.fog;ca=-1;Cb=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b._viewMatrixArray||(b._viewMatrixArray=new Float32Array(16));b._projectionMatrixArray||(b._projectionMatrixArray=new Float32Array(16));b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wa.multiply(b.projectionMatrix,b.matrixWorldInverse);vb.setFromMatrix(Wa);
|
|
|
-this.autoUpdateObjects&&this.initWebGLObjects(a);p(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||vb.contains(g))){y(g,b);var l=f,m=l.buffer,
|
|
|
+this.autoUpdateObjects&&this.initWebGLObjects(a);p(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||vb.contains(g))){u(g,b);var l=f,m=l.buffer,
|
|
|
o=void 0,r=o=void 0,r=l.object.material;if(r instanceof THREE.MeshFaceMaterial)o=m.materialIndex,0<=o&&(o=r.materials[o],o.transparent?(l.transparent=o,l.opaque=null):(l.opaque=o,l.transparent=null));else if(o=r)o.transparent?(l.transparent=o,l.opaque=null):(l.opaque=o,l.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(cb.copy(g.matrixWorld.getPosition()),Wa.multiplyVector3(cb),f.z=cb.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;
|
|
|
-d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(y(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),q(a.__webglObjects,!1,"",b,i,j,!0,d),t(a.__webglObjectsImmediate,"",b,i,j,!1,d)):(this.setBlending(THREE.NormalBlending),
|
|
|
+d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(u(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),q(a.__webglObjects,!1,"",b,i,j,!0,d),t(a.__webglObjectsImmediate,"",b,i,j,!1,d)):(this.setBlending(THREE.NormalBlending),
|
|
|
q(a.__webglObjects,!0,"opaque",b,i,j,!1),t(a.__webglObjectsImmediate,"opaque",b,i,j,!1),q(a.__webglObjects,!1,"transparent",b,i,j,!0),t(a.__webglObjectsImmediate,"transparent",b,i,j,!0));p(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,
|
|
|
c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=z(a,b,c,d,e);aa=-1;G.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,vb):e.render(function(a){G.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=
|
|
|
-a.__objectsAdded[0],l=a,n=void 0,m=void 0,o=void 0,p=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,b instanceof THREE.Mesh)if(m=b.geometry,o=b.material,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var q=m,t=void 0,u=void 0,y=void 0,z=void 0,B=void 0,A=void 0,D=void 0,F={},I=q.morphTargets.length,K=q.morphNormals.length,Y=o instanceof THREE.MeshFaceMaterial;q.geometryGroups={};t=0;for(u=q.faces.length;t<u;t++)y=q.faces[t],
|
|
|
-z=Y?y.materialIndex:void 0,A=void 0!==z?z:-1,void 0===F[A]&&(F[A]={hash:A,counter:0}),D=F[A].hash+"_"+F[A].counter,void 0===q.geometryGroups[D]&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:I,numMorphNormals:K}),B=y instanceof THREE.Face3?3:4,65535<q.geometryGroups[D].vertices+B&&(F[A].counter+=1,D=F[A].hash+"_"+F[A].counter,void 0===q.geometryGroups[D]&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:I,numMorphNormals:K})),
|
|
|
-y instanceof THREE.Face3?q.geometryGroups[D].faces3.push(t):q.geometryGroups[D].faces4.push(t),q.geometryGroups[D].vertices+=B;q.geometryGroupsList=[];var O=void 0;for(O in q.geometryGroups)q.geometryGroups[O].id=eb++,q.geometryGroupsList.push(q.geometryGroups[O])}for(n in m.geometryGroups)if(p=m.geometryGroups[n],!p.__webglVertexBuffer){var J=p;J.__webglVertexBuffer=k.createBuffer();J.__webglNormalBuffer=k.createBuffer();J.__webglTangentBuffer=k.createBuffer();J.__webglColorBuffer=k.createBuffer();
|
|
|
+a.__objectsAdded[0],l=a,n=void 0,m=void 0,o=void 0,p=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,b instanceof THREE.Mesh)if(m=b.geometry,o=b.material,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var q=m,t=void 0,u=void 0,v=void 0,z=void 0,B=void 0,A=void 0,D=void 0,F={},I=q.morphTargets.length,K=q.morphNormals.length,Y=o instanceof THREE.MeshFaceMaterial;q.geometryGroups={};t=0;for(u=q.faces.length;t<u;t++)v=q.faces[t],
|
|
|
+z=Y?v.materialIndex:void 0,A=void 0!==z?z:-1,void 0===F[A]&&(F[A]={hash:A,counter:0}),D=F[A].hash+"_"+F[A].counter,void 0===q.geometryGroups[D]&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:I,numMorphNormals:K}),B=v instanceof THREE.Face3?3:4,65535<q.geometryGroups[D].vertices+B&&(F[A].counter+=1,D=F[A].hash+"_"+F[A].counter,void 0===q.geometryGroups[D]&&(q.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:I,numMorphNormals:K})),
|
|
|
+v instanceof THREE.Face3?q.geometryGroups[D].faces3.push(t):q.geometryGroups[D].faces4.push(t),q.geometryGroups[D].vertices+=B;q.geometryGroupsList=[];var O=void 0;for(O in q.geometryGroups)q.geometryGroups[O].id=eb++,q.geometryGroupsList.push(q.geometryGroups[O])}for(n in m.geometryGroups)if(p=m.geometryGroups[n],!p.__webglVertexBuffer){var J=p;J.__webglVertexBuffer=k.createBuffer();J.__webglNormalBuffer=k.createBuffer();J.__webglTangentBuffer=k.createBuffer();J.__webglColorBuffer=k.createBuffer();
|
|
|
J.__webglUVBuffer=k.createBuffer();J.__webglUV2Buffer=k.createBuffer();J.__webglSkinIndicesBuffer=k.createBuffer();J.__webglSkinWeightsBuffer=k.createBuffer();J.__webglFaceBuffer=k.createBuffer();J.__webglLineBuffer=k.createBuffer();var L=void 0,ba=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=[];L=0;for(ba=J.numMorphTargets;L<ba;L++)J.__webglMorphTargetsBuffers.push(k.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];L=0;for(ba=J.numMorphNormals;L<ba;L++)J.__webglMorphNormalsBuffers.push(k.createBuffer())}G.info.memory.geometries++;
|
|
|
d(p,b);m.verticesNeedUpdate=!0;m.morphTargetsNeedUpdate=!0;m.elementsNeedUpdate=!0;m.uvsNeedUpdate=!0;m.normalsNeedUpdate=!0;m.tangentsNeedUpdate=!0;m.colorsNeedUpdate=!0}}else m instanceof THREE.BufferGeometry&&h(m);else if(b instanceof THREE.Ribbon){if(m=b.geometry,!m.__webglVertexBuffer){var M=m;M.__webglVertexBuffer=k.createBuffer();M.__webglColorBuffer=k.createBuffer();M.__webglNormalBuffer=k.createBuffer();G.info.memory.geometries++;var R=m,aa=b,N=R.vertices.length;R.__vertexArray=new Float32Array(3*
|
|
|
N);R.__colorArray=new Float32Array(3*N);R.__normalArray=new Float32Array(3*N);R.__webglVertexCount=N;c(R,aa);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(m=b.geometry,!m.__webglVertexBuffer){var P=m;P.__webglVertexBuffer=k.createBuffer();P.__webglColorBuffer=k.createBuffer();P.__webglLineDistanceBuffer=k.createBuffer();G.info.memory.geometries++;var Q=m,ha=b,S=Q.vertices.length;Q.__vertexArray=new Float32Array(3*S);Q.__colorArray=new Float32Array(3*
|
|
@@ -430,7 +431,7 @@ l.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instan
|
|
|
H(pa.__webglFlares,na):(na instanceof THREE.ImmediateRenderObject||na.immediateRenderCallback)&&s(pa.__webglObjectsImmediate,na);na.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Ha=0,La=a.__webglObjects.length;Ha<La;Ha++){var qa=a.__webglObjects[Ha].object,U=qa.geometry,Aa=void 0,ya=void 0,ka=void 0;if(qa instanceof THREE.Mesh)if(U instanceof THREE.BufferGeometry)(U.verticesNeedUpdate||U.elementsNeedUpdate||U.uvsNeedUpdate||U.normalsNeedUpdate||U.colorsNeedUpdate||U.tangentsNeedUpdate)&&
|
|
|
j(U,k.DYNAMIC_DRAW,!U.dynamic),U.verticesNeedUpdate=!1,U.elementsNeedUpdate=!1,U.uvsNeedUpdate=!1,U.normalsNeedUpdate=!1,U.colorsNeedUpdate=!1,U.tangentsNeedUpdate=!1;else{for(var Ra=0,Sa=U.geometryGroupsList.length;Ra<Sa;Ra++)if(Aa=U.geometryGroupsList[Ra],ka=e(qa,Aa),U.buffersNeedUpdate&&d(Aa,qa),ya=ka.attributes&&C(ka),U.verticesNeedUpdate||U.morphTargetsNeedUpdate||U.elementsNeedUpdate||U.uvsNeedUpdate||U.normalsNeedUpdate||U.colorsNeedUpdate||U.tangentsNeedUpdate||ya){var ra=Aa,Wa=qa,za=k.DYNAMIC_DRAW,
|
|
|
ub=!U.dynamic,fb=ka;if(ra.__inittedArrays){var pb=f(fb),mb=fb.vertexColors?fb.vertexColors:!1,rb=g(fb),gb=pb===THREE.SmoothShading,E=void 0,Z=void 0,Va=void 0,T=void 0,cb=void 0,Xa=void 0,Gb=void 0,qb=void 0,ab=void 0,lb=void 0,nb=void 0,V=void 0,W=void 0,X=void 0,oa=void 0,Hb=void 0,Ib=void 0,Jb=void 0,sb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,tb=void 0,Nb=void 0,Ob=void 0,Pb=void 0,vb=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Cb=void 0,Tb=void 0,Ub=void 0,Vb=void 0,Db=void 0,ua=void 0,$b=void 0,bc=void 0,
|
|
|
-jc=void 0,kc=void 0,Oa=void 0,hc=void 0,Ma=void 0,Na=void 0,cc=void 0,Xb=void 0,Ia=0,Ka=0,Yb=0,Zb=0,yb=0,Za=0,xa=0,db=0,Ja=0,ga=0,ja=0,x=0,va=void 0,Pa=ra.__vertexArray,oc=ra.__uvArray,pc=ra.__uv2Array,zb=ra.__normalArray,Da=ra.__tangentArray,Qa=ra.__colorArray,Ea=ra.__skinIndexArray,Fa=ra.__skinWeightArray,Rc=ra.__morphTargetsArrays,Sc=ra.__morphNormalsArrays,Tc=ra.__webglCustomAttributesList,v=void 0,Wb=ra.__faceArray,ob=ra.__lineArray,ib=Wa.geometry,wc=ib.elementsNeedUpdate,nc=ib.uvsNeedUpdate,
|
|
|
+jc=void 0,kc=void 0,Oa=void 0,hc=void 0,Ma=void 0,Na=void 0,cc=void 0,Xb=void 0,Ia=0,Ka=0,Yb=0,Zb=0,yb=0,Za=0,xa=0,db=0,Ja=0,ga=0,ja=0,x=0,va=void 0,Pa=ra.__vertexArray,oc=ra.__uvArray,pc=ra.__uv2Array,zb=ra.__normalArray,Da=ra.__tangentArray,Qa=ra.__colorArray,Ea=ra.__skinIndexArray,Fa=ra.__skinWeightArray,Rc=ra.__morphTargetsArrays,Sc=ra.__morphNormalsArrays,Tc=ra.__webglCustomAttributesList,w=void 0,Wb=ra.__faceArray,ob=ra.__lineArray,ib=Wa.geometry,wc=ib.elementsNeedUpdate,nc=ib.uvsNeedUpdate,
|
|
|
xc=ib.normalsNeedUpdate,Oc=ib.tangentsNeedUpdate,Pc=ib.colorsNeedUpdate,gd=ib.morphTargetsNeedUpdate,fc=ib.vertices,sa=ra.faces3,ta=ra.faces4,$a=ib.faces,Uc=ib.faceVertexUvs[0],Vc=ib.faceVertexUvs[1],gc=ib.skinIndices,dc=ib.skinWeights,ec=ib.morphTargets,zc=ib.morphNormals;if(ib.verticesNeedUpdate){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=fc[T.a],W=fc[T.b],X=fc[T.c],Pa[Ka]=V.x,Pa[Ka+1]=V.y,Pa[Ka+2]=V.z,Pa[Ka+3]=W.x,Pa[Ka+4]=W.y,Pa[Ka+5]=W.z,Pa[Ka+6]=X.x,Pa[Ka+7]=X.y,Pa[Ka+8]=X.z,Ka+=9;E=0;for(Z=
|
|
|
ta.length;E<Z;E++)T=$a[ta[E]],V=fc[T.a],W=fc[T.b],X=fc[T.c],oa=fc[T.d],Pa[Ka]=V.x,Pa[Ka+1]=V.y,Pa[Ka+2]=V.z,Pa[Ka+3]=W.x,Pa[Ka+4]=W.y,Pa[Ka+5]=W.z,Pa[Ka+6]=X.x,Pa[Ka+7]=X.y,Pa[Ka+8]=X.z,Pa[Ka+9]=oa.x,Pa[Ka+10]=oa.y,Pa[Ka+11]=oa.z,Ka+=12;k.bindBuffer(k.ARRAY_BUFFER,ra.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Pa,za)}if(gd){Oa=0;for(hc=ec.length;Oa<hc;Oa++){E=ja=0;for(Z=sa.length;E<Z;E++)cc=sa[E],T=$a[cc],V=ec[Oa].vertices[T.a],W=ec[Oa].vertices[T.b],X=ec[Oa].vertices[T.c],Ma=Rc[Oa],Ma[ja]=V.x,
|
|
|
Ma[ja+1]=V.y,Ma[ja+2]=V.z,Ma[ja+3]=W.x,Ma[ja+4]=W.y,Ma[ja+5]=W.z,Ma[ja+6]=X.x,Ma[ja+7]=X.y,Ma[ja+8]=X.z,fb.morphNormals&&(gb?(Xb=zc[Oa].vertexNormals[cc],Kb=Xb.a,Lb=Xb.b,Mb=Xb.c):Mb=Lb=Kb=zc[Oa].faceNormals[cc],Na=Sc[Oa],Na[ja]=Kb.x,Na[ja+1]=Kb.y,Na[ja+2]=Kb.z,Na[ja+3]=Lb.x,Na[ja+4]=Lb.y,Na[ja+5]=Lb.z,Na[ja+6]=Mb.x,Na[ja+7]=Mb.y,Na[ja+8]=Mb.z),ja+=9;E=0;for(Z=ta.length;E<Z;E++)cc=ta[E],T=$a[cc],V=ec[Oa].vertices[T.a],W=ec[Oa].vertices[T.b],X=ec[Oa].vertices[T.c],oa=ec[Oa].vertices[T.d],Ma=Rc[Oa],
|
|
@@ -444,27 +445,27 @@ Hb.x,Da[xa+1]=Hb.y,Da[xa+2]=Hb.z,Da[xa+3]=Hb.w,Da[xa+4]=Ib.x,Da[xa+5]=Ib.y,Da[xa
|
|
|
0;3>ua;ua++)zb[Za]=Xa.x,zb[Za+1]=Xa.y,zb[Za+2]=Xa.z,Za+=3;E=0;for(Z=ta.length;E<Z;E++)if(T=$a[ta[E]],cb=T.vertexNormals,Xa=T.normal,4===cb.length&&gb)for(ua=0;4>ua;ua++)bc=cb[ua],zb[Za]=bc.x,zb[Za+1]=bc.y,zb[Za+2]=bc.z,Za+=3;else for(ua=0;4>ua;ua++)zb[Za]=Xa.x,zb[Za+1]=Xa.y,zb[Za+2]=Xa.z,Za+=3;k.bindBuffer(k.ARRAY_BUFFER,ra.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,zb,za)}if(nc&&Uc&&rb){E=0;for(Z=sa.length;E<Z;E++)if(Va=sa[E],lb=Uc[Va],void 0!==lb)for(ua=0;3>ua;ua++)jc=lb[ua],oc[Yb]=jc.u,oc[Yb+
|
|
|
1]=jc.v,Yb+=2;E=0;for(Z=ta.length;E<Z;E++)if(Va=ta[E],lb=Uc[Va],void 0!==lb)for(ua=0;4>ua;ua++)jc=lb[ua],oc[Yb]=jc.u,oc[Yb+1]=jc.v,Yb+=2;0<Yb&&(k.bindBuffer(k.ARRAY_BUFFER,ra.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,oc,za))}if(nc&&Vc&&rb){E=0;for(Z=sa.length;E<Z;E++)if(Va=sa[E],nb=Vc[Va],void 0!==nb)for(ua=0;3>ua;ua++)kc=nb[ua],pc[Zb]=kc.u,pc[Zb+1]=kc.v,Zb+=2;E=0;for(Z=ta.length;E<Z;E++)if(Va=ta[E],nb=Vc[Va],void 0!==nb)for(ua=0;4>ua;ua++)kc=nb[ua],pc[Zb]=kc.u,pc[Zb+1]=kc.v,Zb+=2;0<Zb&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
ra.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,pc,za))}if(wc){E=0;for(Z=sa.length;E<Z;E++)Wb[yb]=Ia,Wb[yb+1]=Ia+1,Wb[yb+2]=Ia+2,yb+=3,ob[db]=Ia,ob[db+1]=Ia+1,ob[db+2]=Ia,ob[db+3]=Ia+2,ob[db+4]=Ia+1,ob[db+5]=Ia+2,db+=6,Ia+=3;E=0;for(Z=ta.length;E<Z;E++)Wb[yb]=Ia,Wb[yb+1]=Ia+1,Wb[yb+2]=Ia+3,Wb[yb+3]=Ia+1,Wb[yb+4]=Ia+2,Wb[yb+5]=Ia+3,yb+=6,ob[db]=Ia,ob[db+1]=Ia+1,ob[db+2]=Ia,ob[db+3]=Ia+3,ob[db+4]=Ia+1,ob[db+5]=Ia+2,ob[db+6]=Ia+2,ob[db+7]=Ia+3,db+=8,Ia+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ra.__webglFaceBuffer);
|
|
|
-k.bufferData(k.ELEMENT_ARRAY_BUFFER,Wb,za);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ra.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ob,za)}if(Tc){ua=0;for($b=Tc.length;ua<$b;ua++)if(v=Tc[ua],v.__original.needsUpdate){x=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],v.array[x]=v.value[T.a],v.array[x+1]=v.value[T.b],v.array[x+2]=v.value[T.c],x+=3;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],v.array[x]=v.value[T.a],v.array[x+1]=v.value[T.b],v.array[x+
|
|
|
-2]=v.value[T.c],v.array[x+3]=v.value[T.d],x+=4}else{if("faces"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)va=v.value[sa[E]],v.array[x]=va,v.array[x+1]=va,v.array[x+2]=va,x+=3;E=0;for(Z=ta.length;E<Z;E++)va=v.value[ta[E]],v.array[x]=va,v.array[x+1]=va,v.array[x+2]=va,v.array[x+3]=va,x+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=v.value[T.a],W=v.value[T.b],X=v.value[T.c],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=W.x,v.array[x+3]=W.y,
|
|
|
-v.array[x+4]=X.x,v.array[x+5]=X.y,x+=6;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],V=v.value[T.a],W=v.value[T.b],X=v.value[T.c],oa=v.value[T.d],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=W.x,v.array[x+3]=W.y,v.array[x+4]=X.x,v.array[x+5]=X.y,v.array[x+6]=oa.x,v.array[x+7]=oa.y,x+=8}else{if("faces"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)X=W=V=va=v.value[sa[E]],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=W.x,v.array[x+3]=W.y,v.array[x+4]=X.x,v.array[x+5]=X.y,x+=6;E=0;for(Z=ta.length;E<Z;E++)oa=X=W=
|
|
|
-V=va=v.value[ta[E]],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=W.x,v.array[x+3]=W.y,v.array[x+4]=X.x,v.array[x+5]=X.y,v.array[x+6]=oa.x,v.array[x+7]=oa.y,x+=8}}else if(3===v.size){var ea;ea="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=v.value[T.a],W=v.value[T.b],X=v.value[T.c],v.array[x]=V[ea[0]],v.array[x+1]=V[ea[1]],v.array[x+2]=V[ea[2]],v.array[x+3]=W[ea[0]],v.array[x+4]=W[ea[1]],v.array[x+5]=W[ea[2]],v.array[x+
|
|
|
-6]=X[ea[0]],v.array[x+7]=X[ea[1]],v.array[x+8]=X[ea[2]],x+=9;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],V=v.value[T.a],W=v.value[T.b],X=v.value[T.c],oa=v.value[T.d],v.array[x]=V[ea[0]],v.array[x+1]=V[ea[1]],v.array[x+2]=V[ea[2]],v.array[x+3]=W[ea[0]],v.array[x+4]=W[ea[1]],v.array[x+5]=W[ea[2]],v.array[x+6]=X[ea[0]],v.array[x+7]=X[ea[1]],v.array[x+8]=X[ea[2]],v.array[x+9]=oa[ea[0]],v.array[x+10]=oa[ea[1]],v.array[x+11]=oa[ea[2]],x+=12}else if("faces"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)X=W=V=va=
|
|
|
-v.value[sa[E]],v.array[x]=V[ea[0]],v.array[x+1]=V[ea[1]],v.array[x+2]=V[ea[2]],v.array[x+3]=W[ea[0]],v.array[x+4]=W[ea[1]],v.array[x+5]=W[ea[2]],v.array[x+6]=X[ea[0]],v.array[x+7]=X[ea[1]],v.array[x+8]=X[ea[2]],x+=9;E=0;for(Z=ta.length;E<Z;E++)oa=X=W=V=va=v.value[ta[E]],v.array[x]=V[ea[0]],v.array[x+1]=V[ea[1]],v.array[x+2]=V[ea[2]],v.array[x+3]=W[ea[0]],v.array[x+4]=W[ea[1]],v.array[x+5]=W[ea[2]],v.array[x+6]=X[ea[0]],v.array[x+7]=X[ea[1]],v.array[x+8]=X[ea[2]],v.array[x+9]=oa[ea[0]],v.array[x+10]=
|
|
|
-oa[ea[1]],v.array[x+11]=oa[ea[2]],x+=12}else if("faceVertices"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)va=v.value[sa[E]],V=va[0],W=va[1],X=va[2],v.array[x]=V[ea[0]],v.array[x+1]=V[ea[1]],v.array[x+2]=V[ea[2]],v.array[x+3]=W[ea[0]],v.array[x+4]=W[ea[1]],v.array[x+5]=W[ea[2]],v.array[x+6]=X[ea[0]],v.array[x+7]=X[ea[1]],v.array[x+8]=X[ea[2]],x+=9;E=0;for(Z=ta.length;E<Z;E++)va=v.value[ta[E]],V=va[0],W=va[1],X=va[2],oa=va[3],v.array[x]=V[ea[0]],v.array[x+1]=V[ea[1]],v.array[x+2]=V[ea[2]],v.array[x+3]=
|
|
|
-W[ea[0]],v.array[x+4]=W[ea[1]],v.array[x+5]=W[ea[2]],v.array[x+6]=X[ea[0]],v.array[x+7]=X[ea[1]],v.array[x+8]=X[ea[2]],v.array[x+9]=oa[ea[0]],v.array[x+10]=oa[ea[1]],v.array[x+11]=oa[ea[2]],x+=12}}else if(4===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=v.value[T.a],W=v.value[T.b],X=v.value[T.c],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=V.z,v.array[x+3]=V.w,v.array[x+4]=W.x,v.array[x+5]=W.y,v.array[x+6]=W.z,v.array[x+7]=W.w,v.array[x+8]=X.x,v.array[x+
|
|
|
-9]=X.y,v.array[x+10]=X.z,v.array[x+11]=X.w,x+=12;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],V=v.value[T.a],W=v.value[T.b],X=v.value[T.c],oa=v.value[T.d],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=V.z,v.array[x+3]=V.w,v.array[x+4]=W.x,v.array[x+5]=W.y,v.array[x+6]=W.z,v.array[x+7]=W.w,v.array[x+8]=X.x,v.array[x+9]=X.y,v.array[x+10]=X.z,v.array[x+11]=X.w,v.array[x+12]=oa.x,v.array[x+13]=oa.y,v.array[x+14]=oa.z,v.array[x+15]=oa.w,x+=16}else if("faces"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)X=W=V=va=
|
|
|
-v.value[sa[E]],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=V.z,v.array[x+3]=V.w,v.array[x+4]=W.x,v.array[x+5]=W.y,v.array[x+6]=W.z,v.array[x+7]=W.w,v.array[x+8]=X.x,v.array[x+9]=X.y,v.array[x+10]=X.z,v.array[x+11]=X.w,x+=12;E=0;for(Z=ta.length;E<Z;E++)oa=X=W=V=va=v.value[ta[E]],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=V.z,v.array[x+3]=V.w,v.array[x+4]=W.x,v.array[x+5]=W.y,v.array[x+6]=W.z,v.array[x+7]=W.w,v.array[x+8]=X.x,v.array[x+9]=X.y,v.array[x+10]=X.z,v.array[x+11]=X.w,v.array[x+12]=oa.x,
|
|
|
-v.array[x+13]=oa.y,v.array[x+14]=oa.z,v.array[x+15]=oa.w,x+=16}else if("faceVertices"===v.boundTo){E=0;for(Z=sa.length;E<Z;E++)va=v.value[sa[E]],V=va[0],W=va[1],X=va[2],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=V.z,v.array[x+3]=V.w,v.array[x+4]=W.x,v.array[x+5]=W.y,v.array[x+6]=W.z,v.array[x+7]=W.w,v.array[x+8]=X.x,v.array[x+9]=X.y,v.array[x+10]=X.z,v.array[x+11]=X.w,x+=12;E=0;for(Z=ta.length;E<Z;E++)va=v.value[ta[E]],V=va[0],W=va[1],X=va[2],oa=va[3],v.array[x]=V.x,v.array[x+1]=V.y,v.array[x+2]=
|
|
|
-V.z,v.array[x+3]=V.w,v.array[x+4]=W.x,v.array[x+5]=W.y,v.array[x+6]=W.z,v.array[x+7]=W.w,v.array[x+8]=X.x,v.array[x+9]=X.y,v.array[x+10]=X.z,v.array[x+11]=X.w,v.array[x+12]=oa.x,v.array[x+13]=oa.y,v.array[x+14]=oa.z,v.array[x+15]=oa.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,v.buffer);k.bufferData(k.ARRAY_BUFFER,v.array,za)}}ub&&(delete ra.__inittedArrays,delete ra.__colorArray,delete ra.__normalArray,delete ra.__tangentArray,delete ra.__uvArray,delete ra.__uv2Array,delete ra.__faceArray,delete ra.__vertexArray,
|
|
|
-delete ra.__lineArray,delete ra.__skinIndexArray,delete ra.__skinWeightArray)}}U.verticesNeedUpdate=!1;U.morphTargetsNeedUpdate=!1;U.elementsNeedUpdate=!1;U.uvsNeedUpdate=!1;U.normalsNeedUpdate=!1;U.colorsNeedUpdate=!1;U.tangentsNeedUpdate=!1;U.buffersNeedUpdate=!1;ka.attributes&&w(ka)}else if(qa instanceof THREE.Ribbon){ka=e(qa,U);ya=ka.attributes&&C(ka);if(U.verticesNeedUpdate||U.colorsNeedUpdate||U.normalsNeedUpdate||ya){var Ab=U,Ac=k.DYNAMIC_DRAW,qc=void 0,rc=void 0,sc=void 0,Bc=void 0,wa=void 0,
|
|
|
+k.bufferData(k.ELEMENT_ARRAY_BUFFER,Wb,za);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ra.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ob,za)}if(Tc){ua=0;for($b=Tc.length;ua<$b;ua++)if(w=Tc[ua],w.__original.needsUpdate){x=0;if(1===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],w.array[x]=w.value[T.a],w.array[x+1]=w.value[T.b],w.array[x+2]=w.value[T.c],x+=3;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],w.array[x]=w.value[T.a],w.array[x+1]=w.value[T.b],w.array[x+
|
|
|
+2]=w.value[T.c],w.array[x+3]=w.value[T.d],x+=4}else{if("faces"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)va=w.value[sa[E]],w.array[x]=va,w.array[x+1]=va,w.array[x+2]=va,x+=3;E=0;for(Z=ta.length;E<Z;E++)va=w.value[ta[E]],w.array[x]=va,w.array[x+1]=va,w.array[x+2]=va,w.array[x+3]=va,x+=4}}else if(2===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=w.value[T.a],W=w.value[T.b],X=w.value[T.c],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=W.x,w.array[x+3]=W.y,
|
|
|
+w.array[x+4]=X.x,w.array[x+5]=X.y,x+=6;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],V=w.value[T.a],W=w.value[T.b],X=w.value[T.c],oa=w.value[T.d],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=W.x,w.array[x+3]=W.y,w.array[x+4]=X.x,w.array[x+5]=X.y,w.array[x+6]=oa.x,w.array[x+7]=oa.y,x+=8}else{if("faces"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)X=W=V=va=w.value[sa[E]],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=W.x,w.array[x+3]=W.y,w.array[x+4]=X.x,w.array[x+5]=X.y,x+=6;E=0;for(Z=ta.length;E<Z;E++)oa=X=W=
|
|
|
+V=va=w.value[ta[E]],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=W.x,w.array[x+3]=W.y,w.array[x+4]=X.x,w.array[x+5]=X.y,w.array[x+6]=oa.x,w.array[x+7]=oa.y,x+=8}}else if(3===w.size){var ea;ea="c"===w.type?["r","g","b"]:["x","y","z"];if(void 0===w.boundTo||"vertices"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=w.value[T.a],W=w.value[T.b],X=w.value[T.c],w.array[x]=V[ea[0]],w.array[x+1]=V[ea[1]],w.array[x+2]=V[ea[2]],w.array[x+3]=W[ea[0]],w.array[x+4]=W[ea[1]],w.array[x+5]=W[ea[2]],w.array[x+
|
|
|
+6]=X[ea[0]],w.array[x+7]=X[ea[1]],w.array[x+8]=X[ea[2]],x+=9;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],V=w.value[T.a],W=w.value[T.b],X=w.value[T.c],oa=w.value[T.d],w.array[x]=V[ea[0]],w.array[x+1]=V[ea[1]],w.array[x+2]=V[ea[2]],w.array[x+3]=W[ea[0]],w.array[x+4]=W[ea[1]],w.array[x+5]=W[ea[2]],w.array[x+6]=X[ea[0]],w.array[x+7]=X[ea[1]],w.array[x+8]=X[ea[2]],w.array[x+9]=oa[ea[0]],w.array[x+10]=oa[ea[1]],w.array[x+11]=oa[ea[2]],x+=12}else if("faces"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)X=W=V=va=
|
|
|
+w.value[sa[E]],w.array[x]=V[ea[0]],w.array[x+1]=V[ea[1]],w.array[x+2]=V[ea[2]],w.array[x+3]=W[ea[0]],w.array[x+4]=W[ea[1]],w.array[x+5]=W[ea[2]],w.array[x+6]=X[ea[0]],w.array[x+7]=X[ea[1]],w.array[x+8]=X[ea[2]],x+=9;E=0;for(Z=ta.length;E<Z;E++)oa=X=W=V=va=w.value[ta[E]],w.array[x]=V[ea[0]],w.array[x+1]=V[ea[1]],w.array[x+2]=V[ea[2]],w.array[x+3]=W[ea[0]],w.array[x+4]=W[ea[1]],w.array[x+5]=W[ea[2]],w.array[x+6]=X[ea[0]],w.array[x+7]=X[ea[1]],w.array[x+8]=X[ea[2]],w.array[x+9]=oa[ea[0]],w.array[x+10]=
|
|
|
+oa[ea[1]],w.array[x+11]=oa[ea[2]],x+=12}else if("faceVertices"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)va=w.value[sa[E]],V=va[0],W=va[1],X=va[2],w.array[x]=V[ea[0]],w.array[x+1]=V[ea[1]],w.array[x+2]=V[ea[2]],w.array[x+3]=W[ea[0]],w.array[x+4]=W[ea[1]],w.array[x+5]=W[ea[2]],w.array[x+6]=X[ea[0]],w.array[x+7]=X[ea[1]],w.array[x+8]=X[ea[2]],x+=9;E=0;for(Z=ta.length;E<Z;E++)va=w.value[ta[E]],V=va[0],W=va[1],X=va[2],oa=va[3],w.array[x]=V[ea[0]],w.array[x+1]=V[ea[1]],w.array[x+2]=V[ea[2]],w.array[x+3]=
|
|
|
+W[ea[0]],w.array[x+4]=W[ea[1]],w.array[x+5]=W[ea[2]],w.array[x+6]=X[ea[0]],w.array[x+7]=X[ea[1]],w.array[x+8]=X[ea[2]],w.array[x+9]=oa[ea[0]],w.array[x+10]=oa[ea[1]],w.array[x+11]=oa[ea[2]],x+=12}}else if(4===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)T=$a[sa[E]],V=w.value[T.a],W=w.value[T.b],X=w.value[T.c],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=V.z,w.array[x+3]=V.w,w.array[x+4]=W.x,w.array[x+5]=W.y,w.array[x+6]=W.z,w.array[x+7]=W.w,w.array[x+8]=X.x,w.array[x+
|
|
|
+9]=X.y,w.array[x+10]=X.z,w.array[x+11]=X.w,x+=12;E=0;for(Z=ta.length;E<Z;E++)T=$a[ta[E]],V=w.value[T.a],W=w.value[T.b],X=w.value[T.c],oa=w.value[T.d],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=V.z,w.array[x+3]=V.w,w.array[x+4]=W.x,w.array[x+5]=W.y,w.array[x+6]=W.z,w.array[x+7]=W.w,w.array[x+8]=X.x,w.array[x+9]=X.y,w.array[x+10]=X.z,w.array[x+11]=X.w,w.array[x+12]=oa.x,w.array[x+13]=oa.y,w.array[x+14]=oa.z,w.array[x+15]=oa.w,x+=16}else if("faces"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)X=W=V=va=
|
|
|
+w.value[sa[E]],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=V.z,w.array[x+3]=V.w,w.array[x+4]=W.x,w.array[x+5]=W.y,w.array[x+6]=W.z,w.array[x+7]=W.w,w.array[x+8]=X.x,w.array[x+9]=X.y,w.array[x+10]=X.z,w.array[x+11]=X.w,x+=12;E=0;for(Z=ta.length;E<Z;E++)oa=X=W=V=va=w.value[ta[E]],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=V.z,w.array[x+3]=V.w,w.array[x+4]=W.x,w.array[x+5]=W.y,w.array[x+6]=W.z,w.array[x+7]=W.w,w.array[x+8]=X.x,w.array[x+9]=X.y,w.array[x+10]=X.z,w.array[x+11]=X.w,w.array[x+12]=oa.x,
|
|
|
+w.array[x+13]=oa.y,w.array[x+14]=oa.z,w.array[x+15]=oa.w,x+=16}else if("faceVertices"===w.boundTo){E=0;for(Z=sa.length;E<Z;E++)va=w.value[sa[E]],V=va[0],W=va[1],X=va[2],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=V.z,w.array[x+3]=V.w,w.array[x+4]=W.x,w.array[x+5]=W.y,w.array[x+6]=W.z,w.array[x+7]=W.w,w.array[x+8]=X.x,w.array[x+9]=X.y,w.array[x+10]=X.z,w.array[x+11]=X.w,x+=12;E=0;for(Z=ta.length;E<Z;E++)va=w.value[ta[E]],V=va[0],W=va[1],X=va[2],oa=va[3],w.array[x]=V.x,w.array[x+1]=V.y,w.array[x+2]=
|
|
|
+V.z,w.array[x+3]=V.w,w.array[x+4]=W.x,w.array[x+5]=W.y,w.array[x+6]=W.z,w.array[x+7]=W.w,w.array[x+8]=X.x,w.array[x+9]=X.y,w.array[x+10]=X.z,w.array[x+11]=X.w,w.array[x+12]=oa.x,w.array[x+13]=oa.y,w.array[x+14]=oa.z,w.array[x+15]=oa.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.ARRAY_BUFFER,w.array,za)}}ub&&(delete ra.__inittedArrays,delete ra.__colorArray,delete ra.__normalArray,delete ra.__tangentArray,delete ra.__uvArray,delete ra.__uv2Array,delete ra.__faceArray,delete ra.__vertexArray,
|
|
|
+delete ra.__lineArray,delete ra.__skinIndexArray,delete ra.__skinWeightArray)}}U.verticesNeedUpdate=!1;U.morphTargetsNeedUpdate=!1;U.elementsNeedUpdate=!1;U.uvsNeedUpdate=!1;U.normalsNeedUpdate=!1;U.colorsNeedUpdate=!1;U.tangentsNeedUpdate=!1;U.buffersNeedUpdate=!1;ka.attributes&&y(ka)}else if(qa instanceof THREE.Ribbon){ka=e(qa,U);ya=ka.attributes&&C(ka);if(U.verticesNeedUpdate||U.colorsNeedUpdate||U.normalsNeedUpdate||ya){var Ab=U,Ac=k.DYNAMIC_DRAW,qc=void 0,rc=void 0,sc=void 0,Bc=void 0,wa=void 0,
|
|
|
Cc=void 0,Dc=void 0,Ec=void 0,Yc=void 0,Ta=void 0,lc=void 0,Ba=void 0,jb=void 0,Zc=Ab.vertices,$c=Ab.colors,ad=Ab.normals,hd=Zc.length,id=$c.length,jd=ad.length,Fc=Ab.__vertexArray,Gc=Ab.__colorArray,Hc=Ab.__normalArray,kd=Ab.colorsNeedUpdate,ld=Ab.normalsNeedUpdate,Wc=Ab.__webglCustomAttributesList;if(Ab.verticesNeedUpdate){for(qc=0;qc<hd;qc++)Bc=Zc[qc],wa=3*qc,Fc[wa]=Bc.x,Fc[wa+1]=Bc.y,Fc[wa+2]=Bc.z;k.bindBuffer(k.ARRAY_BUFFER,Ab.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Fc,Ac)}if(kd){for(rc=
|
|
|
0;rc<id;rc++)Cc=$c[rc],wa=3*rc,Gc[wa]=Cc.r,Gc[wa+1]=Cc.g,Gc[wa+2]=Cc.b;k.bindBuffer(k.ARRAY_BUFFER,Ab.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Gc,Ac)}if(ld){for(sc=0;sc<jd;sc++)Dc=ad[sc],wa=3*sc,Hc[wa]=Dc.x,Hc[wa+1]=Dc.y,Hc[wa+2]=Dc.z;k.bindBuffer(k.ARRAY_BUFFER,Ab.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Hc,Ac)}if(Wc){Ec=0;for(Yc=Wc.length;Ec<Yc;Ec++)if(Ba=Wc[Ec],Ba.needsUpdate&&(void 0===Ba.boundTo||"vertices"===Ba.boundTo)){wa=0;lc=Ba.value.length;if(1===Ba.size)for(Ta=0;Ta<lc;Ta++)Ba.array[Ta]=
|
|
|
Ba.value[Ta];else if(2===Ba.size)for(Ta=0;Ta<lc;Ta++)jb=Ba.value[Ta],Ba.array[wa]=jb.x,Ba.array[wa+1]=jb.y,wa+=2;else if(3===Ba.size)if("c"===Ba.type)for(Ta=0;Ta<lc;Ta++)jb=Ba.value[Ta],Ba.array[wa]=jb.r,Ba.array[wa+1]=jb.g,Ba.array[wa+2]=jb.b,wa+=3;else for(Ta=0;Ta<lc;Ta++)jb=Ba.value[Ta],Ba.array[wa]=jb.x,Ba.array[wa+1]=jb.y,Ba.array[wa+2]=jb.z,wa+=3;else if(4===Ba.size)for(Ta=0;Ta<lc;Ta++)jb=Ba.value[Ta],Ba.array[wa]=jb.x,Ba.array[wa+1]=jb.y,Ba.array[wa+2]=jb.z,Ba.array[wa+3]=jb.w,wa+=4;k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-Ba.buffer);k.bufferData(k.ARRAY_BUFFER,Ba.array,Ac)}}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;U.normalsNeedUpdate=!1;ka.attributes&&w(ka)}else if(qa instanceof THREE.Line){ka=e(qa,U);ya=ka.attributes&&C(ka);if(U.verticesNeedUpdate||U.colorsNeedUpdate||U.lineDistancesNeedUpdate||ya){var Bb=U,Ic=k.DYNAMIC_DRAW,tc=void 0,uc=void 0,vc=void 0,Jc=void 0,Ga=void 0,Kc=void 0,bd=Bb.vertices,cd=Bb.colors,dd=Bb.lineDistances,md=bd.length,nd=cd.length,od=dd.length,Lc=Bb.__vertexArray,Mc=Bb.__colorArray,
|
|
|
+Ba.buffer);k.bufferData(k.ARRAY_BUFFER,Ba.array,Ac)}}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;U.normalsNeedUpdate=!1;ka.attributes&&y(ka)}else if(qa instanceof THREE.Line){ka=e(qa,U);ya=ka.attributes&&C(ka);if(U.verticesNeedUpdate||U.colorsNeedUpdate||U.lineDistancesNeedUpdate||ya){var Bb=U,Ic=k.DYNAMIC_DRAW,tc=void 0,uc=void 0,vc=void 0,Jc=void 0,Ga=void 0,Kc=void 0,bd=Bb.vertices,cd=Bb.colors,dd=Bb.lineDistances,md=bd.length,nd=cd.length,od=dd.length,Lc=Bb.__vertexArray,Mc=Bb.__colorArray,
|
|
|
ed=Bb.__lineDistanceArray,pd=Bb.colorsNeedUpdate,qd=Bb.lineDistancesNeedUpdate,Xc=Bb.__webglCustomAttributesList,Nc=void 0,fd=void 0,Ua=void 0,mc=void 0,kb=void 0,Ca=void 0;if(Bb.verticesNeedUpdate){for(tc=0;tc<md;tc++)Jc=bd[tc],Ga=3*tc,Lc[Ga]=Jc.x,Lc[Ga+1]=Jc.y,Lc[Ga+2]=Jc.z;k.bindBuffer(k.ARRAY_BUFFER,Bb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Lc,Ic)}if(pd){for(uc=0;uc<nd;uc++)Kc=cd[uc],Ga=3*uc,Mc[Ga]=Kc.r,Mc[Ga+1]=Kc.g,Mc[Ga+2]=Kc.b;k.bindBuffer(k.ARRAY_BUFFER,Bb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
|
Mc,Ic)}if(qd){for(vc=0;vc<od;vc++)ed[vc]=dd[vc];k.bindBuffer(k.ARRAY_BUFFER,Bb.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,ed,Ic)}if(Xc){Nc=0;for(fd=Xc.length;Nc<fd;Nc++)if(Ca=Xc[Nc],Ca.needsUpdate&&(void 0===Ca.boundTo||"vertices"===Ca.boundTo)){Ga=0;mc=Ca.value.length;if(1===Ca.size)for(Ua=0;Ua<mc;Ua++)Ca.array[Ua]=Ca.value[Ua];else if(2===Ca.size)for(Ua=0;Ua<mc;Ua++)kb=Ca.value[Ua],Ca.array[Ga]=kb.x,Ca.array[Ga+1]=kb.y,Ga+=2;else if(3===Ca.size)if("c"===Ca.type)for(Ua=0;Ua<mc;Ua++)kb=
|
|
|
-Ca.value[Ua],Ca.array[Ga]=kb.r,Ca.array[Ga+1]=kb.g,Ca.array[Ga+2]=kb.b,Ga+=3;else for(Ua=0;Ua<mc;Ua++)kb=Ca.value[Ua],Ca.array[Ga]=kb.x,Ca.array[Ga+1]=kb.y,Ca.array[Ga+2]=kb.z,Ga+=3;else if(4===Ca.size)for(Ua=0;Ua<mc;Ua++)kb=Ca.value[Ua],Ca.array[Ga]=kb.x,Ca.array[Ga+1]=kb.y,Ca.array[Ga+2]=kb.z,Ca.array[Ga+3]=kb.w,Ga+=4;k.bindBuffer(k.ARRAY_BUFFER,Ca.buffer);k.bufferData(k.ARRAY_BUFFER,Ca.array,Ic)}}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;U.lineDistancesNeedUpdate=!1;ka.attributes&&w(ka)}else qa instanceof
|
|
|
-THREE.ParticleSystem&&(U instanceof THREE.BufferGeometry?((U.verticesNeedUpdate||U.colorsNeedUpdate)&&j(U,k.DYNAMIC_DRAW,!U.dynamic),U.verticesNeedUpdate=!1,U.colorsNeedUpdate=!1):(ka=e(qa,U),ya=ka.attributes&&C(ka),(U.verticesNeedUpdate||U.colorsNeedUpdate||qa.sortParticles||ya)&&i(U,k.DYNAMIC_DRAW,qa),U.verticesNeedUpdate=!1,U.colorsNeedUpdate=!1,ka.attributes&&w(ka)))}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,l,n,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?
|
|
|
+Ca.value[Ua],Ca.array[Ga]=kb.r,Ca.array[Ga+1]=kb.g,Ca.array[Ga+2]=kb.b,Ga+=3;else for(Ua=0;Ua<mc;Ua++)kb=Ca.value[Ua],Ca.array[Ga]=kb.x,Ca.array[Ga+1]=kb.y,Ca.array[Ga+2]=kb.z,Ga+=3;else if(4===Ca.size)for(Ua=0;Ua<mc;Ua++)kb=Ca.value[Ua],Ca.array[Ga]=kb.x,Ca.array[Ga+1]=kb.y,Ca.array[Ga+2]=kb.z,Ca.array[Ga+3]=kb.w,Ga+=4;k.bindBuffer(k.ARRAY_BUFFER,Ca.buffer);k.bufferData(k.ARRAY_BUFFER,Ca.array,Ic)}}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;U.lineDistancesNeedUpdate=!1;ka.attributes&&y(ka)}else qa instanceof
|
|
|
+THREE.ParticleSystem&&(U instanceof THREE.BufferGeometry?((U.verticesNeedUpdate||U.colorsNeedUpdate)&&j(U,k.DYNAMIC_DRAW,!U.dynamic),U.verticesNeedUpdate=!1,U.colorsNeedUpdate=!1):(ka=e(qa,U),ya=ka.attributes&&C(ka),(U.verticesNeedUpdate||U.colorsNeedUpdate||qa.sortParticles||ya)&&i(U,k.DYNAMIC_DRAW,qa),U.verticesNeedUpdate=!1,U.colorsNeedUpdate=!1,ka.attributes&&y(ka)))}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,l,n,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?
|
|
|
m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var o=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var p,q,r;e=p=q=r=o=0;for(f=b.length;e<f;e++)g=
|
|
|
b[e],g.onlyShadow||(g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&r++,g instanceof THREE.HemisphereLight&&o++);e=p;f=q;g=r;h=o;o=p=0;for(r=b.length;o<r;o++)q=b[o],q.castShadow&&(q instanceof THREE.SpotLight&&p++,q instanceof THREE.DirectionalLight&&!q.shadowCascade&&p++);n=p;Xa&&d&&d.useVertexTexture?l=1024:(b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,
|
|
|
b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{q=a.fragmentShader;r=a.vertexShader;o=a.uniforms;b=a.attributes;p=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,
|
|
@@ -476,9 +477,9 @@ G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.
|
|
|
t=["precision "+Q+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",t,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=B("fragment",t+q);s=B("vertex",s+r);k.attachShader(u,s);k.attachShader(u,t);k.linkProgram(u);k.getProgramParameter(u,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(u,k.VALIDATE_STATUS)+
|
|
|
-", gl error ["+k.getError()+"]");k.deleteShader(t);k.deleteShader(s);u.uniforms={};u.attributes={};var w;s="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?s.push("boneTexture"):s.push("boneGlobalMatrices");for(w in o)s.push(w);w=s;s=0;for(t=w.length;s<t;s++)d=w[s],u.uniforms[d]=k.getUniformLocation(u,d);s="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)s.push("morphTarget"+
|
|
|
-w);for(w=0;w<c.maxMorphNormals;w++)s.push("morphNormal"+w);for(j in b)s.push(j);j=s;w=0;for(b=j.length;w<b;w++)s=j[w],u.attributes[s]=k.getAttribLocation(u,s);u.id=ha++;ba.push({program:u,code:m,usedTimes:1});G.info.memory.programs=ba.length;j=u}a.program=j;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)u=b+j,0<=w[u]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)u=
|
|
|
-b+j,0<=w[u]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?k.frontFace(k.CCW):k.frontFace(k.CW),"back"===a?k.cullFace(k.BACK):"front"===a?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;ya!==b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ya=b);pa!==
|
|
|
+", gl error ["+k.getError()+"]");k.deleteShader(t);k.deleteShader(s);u.uniforms={};u.attributes={};var v;s="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?s.push("boneTexture"):s.push("boneGlobalMatrices");for(v in o)s.push(v);v=s;s=0;for(t=v.length;s<t;s++)d=v[s],u.uniforms[d]=k.getUniformLocation(u,d);s="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(v=0;v<c.maxMorphTargets;v++)s.push("morphTarget"+
|
|
|
+v);for(v=0;v<c.maxMorphNormals;v++)s.push("morphNormal"+v);for(j in b)s.push(j);j=s;v=0;for(b=j.length;v<b;v++)s=j[v],u.attributes[s]=k.getAttribLocation(u,s);u.id=ha++;ba.push({program:u,code:m,usedTimes:1});G.info.memory.programs=ba.length;j=u}a.program=j;v=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)u=b+j,0<=v[u]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)u=
|
|
|
+b+j,0<=v[u]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?k.frontFace(k.CCW):k.frontFace(k.CW),"back"===a?k.cullFace(k.BACK):"front"===a?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;ya!==b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ya=b);pa!==
|
|
|
a&&(a?k.frontFace(k.CW):k.frontFace(k.CCW),pa=a)};this.setDepthTest=function(a){mb!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),mb=a)};this.setDepthWrite=function(a){lb!==a&&(k.depthMask(a),lb=a)};this.setBlending=function(a,b,c,d){a!==Ra&&(a===THREE.NoBlending?k.disable(k.BLEND):a===THREE.AdditiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.SRC_ALPHA,k.ONE)):a===THREE.SubtractiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):
|
|
|
a===THREE.MultiplyBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(k.enable(k.BLEND),k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)),Ra=a);if(a===THREE.CustomBlending){if(b!==fb&&(k.blendEquation(P(b)),fb=b),c!==ub||d!==qb)k.blendFunc(P(c),P(d)),ub=c,qb=d}else qb=ub=fb=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||
|
|
|
(a.__webglInit=!0,a.__webglTexture=k.createTexture(),G.info.memory.textures++);k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=P(a.format),f=P(a.type);K(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var f=a.mipmaps,g=0,h=f.length;g<h;g++)c=f[g],k.compressedTexImage2D(k.TEXTURE_2D,
|
|
@@ -505,15 +506,15 @@ c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:functio
|
|
|
c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,m=new THREE.Face3,n=new THREE.Face3;m.color.copy(d.color);n.color.copy(d.color);m.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;m.a=e;m.b=i;m.c=l;n.a=i;n.b=j;n.c=l;4===d.vertexColors.length&&(m.vertexColors[0]=d.vertexColors[0].clone(),m.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
m.vertexColors[2]=d.vertexColors[3].clone(),n.vertexColors[0]=d.vertexColors[1].clone(),n.vertexColors[1]=d.vertexColors[2].clone(),n.vertexColors[2]=d.vertexColors[3].clone());f.push(m,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(m=a.faceVertexUvs[d][b],i=m[1],j=m[2],l=m[3],m=[m[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(m,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=
|
|
|
a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());
|
|
|
-b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,l,m,n,o,p,q,t,r,C,w,s,H=[],z=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],l=a.vertices[g],
|
|
|
-m=a.vertices[h],o=j.distanceTo(l),p=l.distanceTo(m),n=j.distanceTo(m),o>b||p>b||n>b){i=a.vertices.length;w=e.clone();s=e.clone();o>=p&&o>=n?(j=j.clone(),j.lerpSelf(l,0.5),w.a=f,w.b=i,w.c=h,s.a=i,s.b=g,s.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),w.vertexNormals[1].copy(f),s.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),w.vertexColors[1].copy(f),s.vertexColors[0].copy(f)),e=0):
|
|
|
-p>=o&&p>=n?(j=l.clone(),j.lerpSelf(m,0.5),w.a=f,w.b=g,w.c=i,s.a=i,s.b=h,s.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),w.vertexNormals[2].copy(f),s.vertexNormals[0].copy(f),s.vertexNormals[1].copy(e.vertexNormals[2]),s.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),w.vertexColors[2].copy(f),s.vertexColors[0].copy(f),s.vertexColors[1].copy(e.vertexColors[2]),s.vertexColors[2].copy(e.vertexColors[0])),
|
|
|
-e=1):(j=j.clone(),j.lerpSelf(m,0.5),w.a=f,w.b=g,w.c=i,s.a=i,s.b=g,s.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),w.vertexNormals[2].copy(f),s.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),w.vertexColors[2].copy(f),s.vertexColors[0].copy(f)),e=2);H.push(w,s);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],s=j[0],h=
|
|
|
-j[1],w=j[2],0===e?(l=s.clone(),l.lerpSelf(h,0.5),j=[s.clone(),l.clone(),w.clone()],h=[l.clone(),h.clone(),w.clone()]):1===e?(l=h.clone(),l.lerpSelf(w,0.5),j=[s.clone(),h.clone(),l.clone()],h=[l.clone(),w.clone(),s.clone()]):(l=s.clone(),l.lerpSelf(w,0.5),j=[s.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),w.clone()]),z[f].push(j,h))}else{H.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],l=a.vertices[g],m=a.vertices[h],
|
|
|
-n=a.vertices[i],o=j.distanceTo(l),p=l.distanceTo(m),q=m.distanceTo(n),t=j.distanceTo(n),o>b||p>b||q>b||t>b){r=a.vertices.length;C=a.vertices.length+1;w=e.clone();s=e.clone();o>=p&&o>=q&&o>=t||q>=p&&q>=o&&q>=t?(o=j.clone(),o.lerpSelf(l,0.5),l=m.clone(),l.lerpSelf(n,0.5),w.a=f,w.b=r,w.c=C,w.d=i,s.a=r,s.b=g,s.c=h,s.d=C,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),w.vertexNormals[1].copy(f),
|
|
|
-w.vertexNormals[2].copy(g),s.vertexNormals[0].copy(f),s.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),w.vertexColors[1].copy(f),w.vertexColors[2].copy(g),s.vertexColors[0].copy(f),s.vertexColors[3].copy(g)),e=0):(o=l.clone(),o.lerpSelf(m,0.5),l=n.clone(),l.lerpSelf(j,0.5),w.a=f,w.b=g,w.c=r,w.d=C,s.a=C,s.b=r,s.c=h,s.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),
|
|
|
-f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),w.vertexNormals[2].copy(f),w.vertexNormals[3].copy(g),s.vertexNormals[0].copy(g),s.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),w.vertexColors[2].copy(f),w.vertexColors[3].copy(g),s.vertexColors[0].copy(g),s.vertexColors[1].copy(f)),e=1);H.push(w,s);a.vertices.push(o,l);
|
|
|
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],s=j[0],h=j[1],w=j[2],j=j[3],0===e?(l=s.clone(),l.lerpSelf(h,0.5),m=w.clone(),m.lerpSelf(j,0.5),s=[s.clone(),l.clone(),m.clone(),j.clone()],h=[l.clone(),h.clone(),w.clone(),m.clone()]):(l=h.clone(),l.lerpSelf(w,0.5),m=j.clone(),m.lerpSelf(s,0.5),s=[s.clone(),h.clone(),l.clone(),m.clone()],h=[m.clone(),l.clone(),w.clone(),j.clone()]),z[f].push(s,h))}else{H.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}a.faces=
|
|
|
+b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,l,m,n,o,p,q,t,r,C,y,s,H=[],z=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],l=a.vertices[g],
|
|
|
+m=a.vertices[h],o=j.distanceTo(l),p=l.distanceTo(m),n=j.distanceTo(m),o>b||p>b||n>b){i=a.vertices.length;y=e.clone();s=e.clone();o>=p&&o>=n?(j=j.clone(),j.lerpSelf(l,0.5),y.a=f,y.b=i,y.c=h,s.a=i,s.b=g,s.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),y.vertexNormals[1].copy(f),s.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),y.vertexColors[1].copy(f),s.vertexColors[0].copy(f)),e=0):
|
|
|
+p>=o&&p>=n?(j=l.clone(),j.lerpSelf(m,0.5),y.a=f,y.b=g,y.c=i,s.a=i,s.b=h,s.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),y.vertexNormals[2].copy(f),s.vertexNormals[0].copy(f),s.vertexNormals[1].copy(e.vertexNormals[2]),s.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),y.vertexColors[2].copy(f),s.vertexColors[0].copy(f),s.vertexColors[1].copy(e.vertexColors[2]),s.vertexColors[2].copy(e.vertexColors[0])),
|
|
|
+e=1):(j=j.clone(),j.lerpSelf(m,0.5),y.a=f,y.b=g,y.c=i,s.a=i,s.b=g,s.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),y.vertexNormals[2].copy(f),s.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),y.vertexColors[2].copy(f),s.vertexColors[0].copy(f)),e=2);H.push(y,s);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],s=j[0],h=
|
|
|
+j[1],y=j[2],0===e?(l=s.clone(),l.lerpSelf(h,0.5),j=[s.clone(),l.clone(),y.clone()],h=[l.clone(),h.clone(),y.clone()]):1===e?(l=h.clone(),l.lerpSelf(y,0.5),j=[s.clone(),h.clone(),l.clone()],h=[l.clone(),y.clone(),s.clone()]):(l=s.clone(),l.lerpSelf(y,0.5),j=[s.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),y.clone()]),z[f].push(j,h))}else{H.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],l=a.vertices[g],m=a.vertices[h],
|
|
|
+n=a.vertices[i],o=j.distanceTo(l),p=l.distanceTo(m),q=m.distanceTo(n),t=j.distanceTo(n),o>b||p>b||q>b||t>b){r=a.vertices.length;C=a.vertices.length+1;y=e.clone();s=e.clone();o>=p&&o>=q&&o>=t||q>=p&&q>=o&&q>=t?(o=j.clone(),o.lerpSelf(l,0.5),l=m.clone(),l.lerpSelf(n,0.5),y.a=f,y.b=r,y.c=C,y.d=i,s.a=r,s.b=g,s.c=h,s.d=C,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),y.vertexNormals[1].copy(f),
|
|
|
+y.vertexNormals[2].copy(g),s.vertexNormals[0].copy(f),s.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),y.vertexColors[1].copy(f),y.vertexColors[2].copy(g),s.vertexColors[0].copy(f),s.vertexColors[3].copy(g)),e=0):(o=l.clone(),o.lerpSelf(m,0.5),l=n.clone(),l.lerpSelf(j,0.5),y.a=f,y.b=g,y.c=r,y.d=C,s.a=C,s.b=r,s.c=h,s.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),
|
|
|
+f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),y.vertexNormals[2].copy(f),y.vertexNormals[3].copy(g),s.vertexNormals[0].copy(g),s.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),y.vertexColors[2].copy(f),y.vertexColors[3].copy(g),s.vertexColors[0].copy(g),s.vertexColors[1].copy(f)),e=1);H.push(y,s);a.vertices.push(o,l);
|
|
|
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],s=j[0],h=j[1],y=j[2],j=j[3],0===e?(l=s.clone(),l.lerpSelf(h,0.5),m=y.clone(),m.lerpSelf(j,0.5),s=[s.clone(),l.clone(),m.clone(),j.clone()],h=[l.clone(),h.clone(),y.clone(),m.clone()]):(l=h.clone(),l.lerpSelf(y,0.5),m=j.clone(),m.lerpSelf(s,0.5),s=[s.clone(),h.clone(),l.clone(),m.clone()],h=[m.clone(),l.clone(),y.clone(),j.clone()]),z[f].push(s,h))}else{H.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}a.faces=
|
|
|
H;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
|
!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};h.onerror=
|
|
@@ -537,8 +538,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
|
|
|
0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,m,n,o,p,q,t,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
c+d;l=b[a++]*c;o=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(o,p,i,l);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var C=g/h;THREE.Shape.Utils.b2(C,m,o,i);THREE.Shape.Utils.b2(C,n,p,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,o=b[a++]*c+d,p=b[a++]*-c,q=b[a++]*c+d,t=b[a++]*-c,e.bezierCurveTo(i,l,o,p,q,t),g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++)C=g/h,THREE.Shape.Utils.b3(C,m,o,q,i),THREE.Shape.Utils.b3(C,n,p,t,l)}}}return{offset:r.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var m=2*e;for(j=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var o=i,p=j,q=l,t=e,r=g,C=void 0,w=void 0,s=void 0,H=void 0,z=void 0,
|
|
|
-u=void 0,y=void 0,D=void 0,A=void 0,w=n[r[o]].x,s=n[r[o]].y,H=n[r[p]].x,z=n[r[p]].y,u=n[r[q]].x,y=n[r[q]].y;if(1E-10>(H-w)*(y-s)-(z-s)*(u-w))n=!1;else{for(C=0;C<t;C++)if(!(C==o||C==p||C==q)){var D=n[r[C]].x,A=n[r[C]].y,I=void 0,J=void 0,B=void 0,K=void 0,F=void 0,L=void 0,P=void 0,N=void 0,Q=void 0,S=void 0,M=void 0,O=void 0,I=B=F=void 0,I=u-H,J=y-z,B=w-u,K=s-y,F=H-w,L=z-s,P=D-w,N=A-s,Q=D-H,S=A-z,M=D-u,O=A-y,I=I*S-J*Q,F=F*N-L*P,B=B*O-K*M;if(0<=I&&0<=B&&0<=F){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
|
|
|
+(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 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var m=2*e;for(j=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var o=i,p=j,q=l,t=e,r=g,C=void 0,y=void 0,s=void 0,H=void 0,z=void 0,
|
|
|
+v=void 0,u=void 0,D=void 0,A=void 0,y=n[r[o]].x,s=n[r[o]].y,H=n[r[p]].x,z=n[r[p]].y,v=n[r[q]].x,u=n[r[q]].y;if(1E-10>(H-y)*(u-s)-(z-s)*(v-y))n=!1;else{for(C=0;C<t;C++)if(!(C==o||C==p||C==q)){var D=n[r[C]].x,A=n[r[C]].y,I=void 0,J=void 0,B=void 0,K=void 0,F=void 0,L=void 0,P=void 0,N=void 0,Q=void 0,S=void 0,M=void 0,O=void 0,I=B=F=void 0,I=v-H,J=u-z,B=y-v,K=s-u,F=H-y,L=z-s,P=D-y,N=A-s,Q=D-H,S=A-z,M=D-v,O=A-u,I=I*S-J*Q,F=F*N-L*P,B=B*O-K*M;if(0<=I&&0<=B&&0<=F){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
|
|
|
a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;m=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};
|
|
|
THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
|
|
|
THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};
|
|
@@ -623,22 +624,22 @@ THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a
|
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
|
|
|
f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,q){var t,r=h.widthSegments,C=h.heightSegments,w=e/2,s=f/2,H=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)t="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)t="y",C=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)t="x",r=h.depthSegments;var z=r+1,u=C+1,y=e/r,D=f/C,A=new THREE.Vector3;A[t]=0<g?1:-1;for(e=0;e<u;e++)for(f=0;f<z;f++){var I=new THREE.Vector3;I[a]=(f*y-w)*c;I[b]=(e*D-s)*d;I[t]=g;h.vertices.push(I)}for(e=
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,q){var t,r=h.widthSegments,C=h.heightSegments,y=e/2,s=f/2,H=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)t="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)t="y",C=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)t="x",r=h.depthSegments;var z=r+1,v=C+1,u=e/r,D=f/C,A=new THREE.Vector3;A[t]=0<g?1:-1;for(e=0;e<v;e++)for(f=0;f<z;f++){var I=new THREE.Vector3;I[a]=(f*u-y)*c;I[b]=(e*D-s)*d;I[t]=g;h.vertices.push(I)}for(e=
|
|
|
0;e<C;e++)for(f=0;f<r;f++)a=new THREE.Face4(f+z*e+H,f+z*(e+1)+H,f+1+z*(e+1)+H,f+1+z*e+H),a.normal.copy(A),a.vertexNormals.push(A.clone(),A.clone(),A.clone(),A.clone()),a.materialIndex=q,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.UV(f/r,1-e/C),new THREE.UV(f/r,1-(e+1)/C),new THREE.UV((f+1)/r,1-(e+1)/C),new THREE.UV((f+1)/r,1-e/C)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/
|
|
|
2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],o=i/e,p=o*(b-a)+a;for(h=0;h<=d;h++){var q=h/d,t=new THREE.Vector3;t.x=p*Math.sin(2*q*Math.PI);t.y=-o*c+g;t.z=p*Math.cos(2*q*Math.PI);this.vertices.push(t);m.push(this.vertices.length-1);n.push(new THREE.UV(q,1-o))}j.push(m);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(m=this.vertices[j[0][h]].clone(),n=this.vertices[j[0][h+
|
|
|
-1]].clone()):(m=this.vertices[j[1][h]].clone(),n=this.vertices[j[1][h+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var o=j[i][h],p=j[i+1][h],q=j[i+1][h+1],t=j[i][h+1],r=m.clone(),C=m.clone(),w=n.clone(),s=n.clone(),H=l[i][h].clone(),z=l[i+1][h].clone(),u=l[i+1][h+1].clone(),y=l[i][h+1].clone();this.faces.push(new THREE.Face4(o,p,q,t,[r,C,w,s]));this.faceVertexUvs[0].push([H,z,u,y])}}if(!f&&0<a){this.vertices.push(new THREE.Vector3(0,
|
|
|
-g,0));for(h=0;h<d;h++)o=j[0][h],p=j[0][h+1],q=this.vertices.length-1,r=new THREE.Vector3(0,1,0),C=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),H=l[0][h].clone(),z=l[0][h+1].clone(),u=new THREE.UV(z.u,0),this.faces.push(new THREE.Face3(o,p,q,[r,C,w])),this.faceVertexUvs[0].push([H,z,u])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)o=j[i][h+1],p=j[i][h],q=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),C=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),H=
|
|
|
-l[i][h+1].clone(),z=l[i][h].clone(),u=new THREE.UV(z.u,1),this.faces.push(new THREE.Face3(o,p,q,[r,C,w])),this.faceVertexUvs[0].push([H,z,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};
|
|
|
+1]].clone()):(m=this.vertices[j[1][h]].clone(),n=this.vertices[j[1][h+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var o=j[i][h],p=j[i+1][h],q=j[i+1][h+1],t=j[i][h+1],r=m.clone(),C=m.clone(),y=n.clone(),s=n.clone(),H=l[i][h].clone(),z=l[i+1][h].clone(),v=l[i+1][h+1].clone(),u=l[i][h+1].clone();this.faces.push(new THREE.Face4(o,p,q,t,[r,C,y,s]));this.faceVertexUvs[0].push([H,z,v,u])}}if(!f&&0<a){this.vertices.push(new THREE.Vector3(0,
|
|
|
+g,0));for(h=0;h<d;h++)o=j[0][h],p=j[0][h+1],q=this.vertices.length-1,r=new THREE.Vector3(0,1,0),C=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),H=l[0][h].clone(),z=l[0][h+1].clone(),v=new THREE.UV(z.u,0),this.faces.push(new THREE.Face3(o,p,q,[r,C,y])),this.faceVertexUvs[0].push([H,z,v])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)o=j[i][h+1],p=j[i][h],q=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),C=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),H=
|
|
|
+l[i][h+1].clone(),z=l[i][h].clone(),v=new THREE.UV(z.u,1),this.faces.push(new THREE.Face3(o,p,q,[r,C,y])),this.faceVertexUvs[0].push([H,z,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};
|
|
|
THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);
|
|
|
for(var g=0,h=n+2*l,g=0;g<h;g++){var i=Q*g,j=Q*(g+1),m=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,q=g,s=h,t=e,u=f,m=m+I,i=i+I,o=o+I,j=j+I;A.faces.push(new THREE.Face4(m,i,o,j,null,null,r));m=C.generateSideWallUV(A,a,p,b,m,i,o,j,q,s,t,u);A.faceVertexUvs[0].push(m)}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=I;d+=I;e+=I;A.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?C.generateBottomUV(A,a,b,c,d,e):C.generateTopUV(A,a,b,c,d,e);A.faceVertexUvs[0].push(c)}var h=void 0!==
|
|
|
-b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.steps?b.steps:1,o=b.extrudePath,p,q=!1,t=b.material,r=b.extrudeMaterial,C=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,s,H,z;o&&(p=o.getSpacedPoints(n),q=!0,m=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(o,n,!1),s=new THREE.Vector3,H=new THREE.Vector3,
|
|
|
-z=new THREE.Vector3);m||(j=i=l=0);var u,y,D,A=this,I=this.vertices.length,o=a.extractPoints(),J=o.shape,o=o.holes,B=!THREE.Shape.Utils.isClockWise(J);if(B){J=J.reverse();y=0;for(D=o.length;y<D;y++)u=o[y],THREE.Shape.Utils.isClockWise(u)&&(o[y]=u.reverse());B=!1}var K=THREE.Shape.Utils.triangulateShape(J,o),B=J;y=0;for(D=o.length;y<D;y++)u=o[y],J=J.concat(u);var F,L,P,N,Q=J.length,S=K.length,M=[],O=0,R=B.length;F=R-1;for(L=O+1;O<R;O++,F++,L++)F===R&&(F=0),L===R&&(L=0),M[O]=d(B[O],B[F],B[L]);var $=
|
|
|
-[],fa,Ha=M.concat();y=0;for(D=o.length;y<D;y++){u=o[y];fa=[];O=0;R=u.length;F=R-1;for(L=O+1;O<R;O++,F++,L++)F===R&&(F=0),L===R&&(L=0),fa[O]=d(u[O],u[F],u[L]);$.push(fa);Ha=Ha.concat(fa)}for(F=0;F<l;F++){u=F/l;P=i*(1-u);L=j*Math.sin(u*Math.PI/2);O=0;for(R=B.length;O<R;O++)N=c(B[O],M[O],L),f(N.x,N.y,-P);y=0;for(D=o.length;y<D;y++){u=o[y];fa=$[y];O=0;for(R=u.length;O<R;O++)N=c(u[O],fa[O],L),f(N.x,N.y,-P)}}L=j;for(O=0;O<Q;O++)N=m?c(J[O],Ha[O],L):J[O],q?(H.copy(w.normals[0]).multiplyScalar(N.x),s.copy(w.binormals[0]).multiplyScalar(N.y),
|
|
|
-z.copy(p[0]).addSelf(H).addSelf(s),f(z.x,z.y,z.z)):f(N.x,N.y,0);for(u=1;u<=n;u++)for(O=0;O<Q;O++)N=m?c(J[O],Ha[O],L):J[O],q?(H.copy(w.normals[u]).multiplyScalar(N.x),s.copy(w.binormals[u]).multiplyScalar(N.y),z.copy(p[u]).addSelf(H).addSelf(s),f(z.x,z.y,z.z)):f(N.x,N.y,h/n*u);for(F=l-1;0<=F;F--){u=F/l;P=i*(1-u);L=j*Math.sin(u*Math.PI/2);O=0;for(R=B.length;O<R;O++)N=c(B[O],M[O],L),f(N.x,N.y,h+P);y=0;for(D=o.length;y<D;y++){u=o[y];fa=$[y];O=0;for(R=u.length;O<R;O++)N=c(u[O],fa[O],L),q?f(N.x,N.y+p[n-
|
|
|
-1].y,p[n-1].x+P):f(N.x,N.y,h+P)}}if(m){i=0*Q;for(O=0;O<S;O++)h=K[O],g(h[2]+i,h[1]+i,h[0]+i,!0);i=Q*(n+2*l);for(O=0;O<S;O++)h=K[O],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(O=0;O<S;O++)h=K[O],g(h[2],h[1],h[0],!0);for(O=0;O<S;O++)h=K[O],g(h[0]+Q*n,h[1]+Q*n,h[2]+Q*n,!1)}h=0;e(B,h);h+=B.length;y=0;for(D=o.length;y<D;y++)u=o[y],e(u,h),h+=u.length};
|
|
|
+b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.steps?b.steps:1,o=b.extrudePath,p,q=!1,t=b.material,r=b.extrudeMaterial,C=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,y,s,H,z;o&&(p=o.getSpacedPoints(n),q=!0,m=!1,y=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(o,n,!1),s=new THREE.Vector3,H=new THREE.Vector3,
|
|
|
+z=new THREE.Vector3);m||(j=i=l=0);var v,u,D,A=this,I=this.vertices.length,o=a.extractPoints(),J=o.shape,o=o.holes,B=!THREE.Shape.Utils.isClockWise(J);if(B){J=J.reverse();u=0;for(D=o.length;u<D;u++)v=o[u],THREE.Shape.Utils.isClockWise(v)&&(o[u]=v.reverse());B=!1}var K=THREE.Shape.Utils.triangulateShape(J,o),B=J;u=0;for(D=o.length;u<D;u++)v=o[u],J=J.concat(v);var F,L,P,N,Q=J.length,S=K.length,M=[],O=0,R=B.length;F=R-1;for(L=O+1;O<R;O++,F++,L++)F===R&&(F=0),L===R&&(L=0),M[O]=d(B[O],B[F],B[L]);var $=
|
|
|
+[],fa,Ha=M.concat();u=0;for(D=o.length;u<D;u++){v=o[u];fa=[];O=0;R=v.length;F=R-1;for(L=O+1;O<R;O++,F++,L++)F===R&&(F=0),L===R&&(L=0),fa[O]=d(v[O],v[F],v[L]);$.push(fa);Ha=Ha.concat(fa)}for(F=0;F<l;F++){v=F/l;P=i*(1-v);L=j*Math.sin(v*Math.PI/2);O=0;for(R=B.length;O<R;O++)N=c(B[O],M[O],L),f(N.x,N.y,-P);u=0;for(D=o.length;u<D;u++){v=o[u];fa=$[u];O=0;for(R=v.length;O<R;O++)N=c(v[O],fa[O],L),f(N.x,N.y,-P)}}L=j;for(O=0;O<Q;O++)N=m?c(J[O],Ha[O],L):J[O],q?(H.copy(y.normals[0]).multiplyScalar(N.x),s.copy(y.binormals[0]).multiplyScalar(N.y),
|
|
|
+z.copy(p[0]).addSelf(H).addSelf(s),f(z.x,z.y,z.z)):f(N.x,N.y,0);for(v=1;v<=n;v++)for(O=0;O<Q;O++)N=m?c(J[O],Ha[O],L):J[O],q?(H.copy(y.normals[v]).multiplyScalar(N.x),s.copy(y.binormals[v]).multiplyScalar(N.y),z.copy(p[v]).addSelf(H).addSelf(s),f(z.x,z.y,z.z)):f(N.x,N.y,h/n*v);for(F=l-1;0<=F;F--){v=F/l;P=i*(1-v);L=j*Math.sin(v*Math.PI/2);O=0;for(R=B.length;O<R;O++)N=c(B[O],M[O],L),f(N.x,N.y,h+P);u=0;for(D=o.length;u<D;u++){v=o[u];fa=$[u];O=0;for(R=v.length;O<R;O++)N=c(v[O],fa[O],L),q?f(N.x,N.y+p[n-
|
|
|
+1].y,p[n-1].x+P):f(N.x,N.y,h+P)}}if(m){i=0*Q;for(O=0;O<S;O++)h=K[O],g(h[2]+i,h[1]+i,h[0]+i,!0);i=Q*(n+2*l);for(O=0;O<S;O++)h=K[O],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(O=0;O<S;O++)h=K[O],g(h[2],h[1],h[0],!0);for(O=0;O<S;O++)h=K[O],g(h[0]+Q*n,h[1]+Q*n,h[2]+Q*n,!1)}h=0;e(B,h);h+=B.length;u=0;for(D=o.length;u<D;u++)v=o[u],e(v,h),h+=v.length};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,a.vertices[d].y),new THREE.UV(b,e),new THREE.UV(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=a.vertices[g].y,
|
|
|
g=a.vertices[g].z,m=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,1-e),new THREE.UV(d,1-f),new THREE.UV(j,1-g),new THREE.UV(m,1-a)]:[new THREE.UV(c,1-e),new THREE.UV(i,1-f),new THREE.UV(l,1-g),new THREE.UV(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
@@ -709,13 +710,13 @@ this.lightRays.material.color.copy(this.color);this.lightCone.material.color.cop
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0;this.debug=!1};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};THREE.GeometryUtils.orderedKey=function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)};
|
|
|
THREE.GeometryUtils.computeEdgeFaces=function(a){function b(a,b){void 0===g[a]&&(g[a]=[]);g[a].push(b)}var c,d,e,f,g={},h=THREE.GeometryUtils.orderedKey;c=0;for(d=a.faces.length;c<d;c++)e=a.faces[c],e instanceof THREE.Face3?(f=h(e.a,e.b),b(f,c),f=h(e.b,e.c),b(f,c),f=h(e.c,e.a),b(f,c)):e instanceof THREE.Face4&&(f=h(e.a,e.b),b(f,c),f=h(e.b,e.c),b(f,c),f=h(e.c,e.d),b(f,c),f=h(e.d,e.a),b(f,c));return g};
|
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&(console&&console.assert)&&console.assert.apply(console,arguments)}function c(){l.debug&&console.log.apply(console,arguments)}function d(){console&&console.log.apply(console,arguments)}function e(a,b,d,e,g,h,m){var n=new THREE.Face4(a,b,d,e,null,g.color,g.materialIndex);if(l.useOldVertexColors){n.vertexColors=[];for(var o,p,q,r=0;4>r;r++){q=h[r];o=new THREE.Color;o.setRGB(0,0,0);for(var s=0;s<q.length;s++)p=g.vertexColors[q[s]-
|
|
|
-1],o.r+=p.r,o.g+=p.g,o.b+=p.b;o.r/=q.length;o.g/=q.length;o.b/=q.length;n.vertexColors[r]=o}}i.push(n);l.supportUVs&&(g=[f(a,""),f(b,m),f(d,m),f(e,m)],g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",e+":"+m):c("c :( ",d+":"+m):c("b :( ",b+":"+m):c("a :( ",a+":"+m))}function f(a,b){var e=a+":"+b,f=w[e];return!f?(a>=q&&a<q+p.length?c("face pt"):c("edge pt"),d("warning, UV not found for",e),null):f}function g(a,b,c){var e=a+":"+b;e in w?d("dup vertexNo",a,"oldFaceNo",b,"value",c,"key",e,w[e]):w[e]=c}var h=[],
|
|
|
-i=[],j=[],l=this,m=THREE.GeometryUtils.orderedKey,n=THREE.GeometryUtils.computeEdgeFaces,o=a.vertices,p=a.faces,q=o.length,h=o.concat(),t=[],r={},C={},w={},s,H,z,u,y,D=a.faceVertexUvs[0],A;c("originalFaces, uvs, originalVerticesLength",p.length,D.length,q);if(l.supportUVs){s=0;for(H=D.length;s<H;s++){z=0;for(u=D[s].length;z<u;z++)A=p[s]["abcd".charAt(z)],g(A,s,D[s][z])}}0==D.length&&(l.supportUVs=!1);s=0;for(var I in w)s++;s||(l.supportUVs=!1,c("no uvs"));s=0;for(H=p.length;s<H;s++)y=p[s],t.push(y.centroid),
|
|
|
-h.push(y.centroid),l.supportUVs&&(u=new THREE.UV,y instanceof THREE.Face3?(u.u=f(y.a,s).u+f(y.b,s).u+f(y.c,s).u,u.v=f(y.a,s).v+f(y.b,s).v+f(y.c,s).v,u.u/=3,u.v/=3):y instanceof THREE.Face4&&(u.u=f(y.a,s).u+f(y.b,s).u+f(y.c,s).u+f(y.d,s).u,u.v=f(y.a,s).v+f(y.b,s).v+f(y.c,s).v+f(y.d,s).v,u.u/=4,u.v/=4),g(q+s,"",u));var n=n(a),J;H=0;var B,K;I={};D={};for(s in n){A=n[s];B=s.split("_");K=B[0];B=B[1];z=K;y=[K,B];void 0===I[z]&&(I[z]=[]);I[z].push(y);z=B;y=[K,B];void 0===I[z]&&(I[z]=[]);I[z].push(y);z=0;
|
|
|
-for(u=A.length;z<u;z++){y=A[z];J=K;var F=y,L=s;void 0===D[J]&&(D[J]={});D[J][F]=L;J=B;F=s;void 0===D[J]&&(D[J]={});D[J][y]=F}2>A.length&&(C[s]=!0)}for(s in n)if(A=n[s],y=A[0],J=A[1],B=s.split("_"),K=B[0],B=B[1],u=new THREE.Vector3,b(0<A.length,"an edge without faces?!"),1==A.length?(u.addSelf(o[K]),u.addSelf(o[B]),u.multiplyScalar(0.5)):(u.addSelf(t[y]),u.addSelf(t[J]),u.addSelf(o[K]),u.addSelf(o[B]),u.multiplyScalar(0.25)),r[s]=q+p.length+H,h.push(u),H++,l.supportUVs)u=new THREE.UV,u.u=f(K,y).u+
|
|
|
-f(B,y).u,u.v=f(K,y).v+f(B,y).v,u.u/=2,u.v/=2,g(r[s],y,u),2<=A.length&&(b(2==A.length,"did we plan for more than 2 edges?"),u=new THREE.UV,u.u=f(K,J).u+f(B,J).u,u.v=f(K,J).v+f(B,J).v,u.u/=2,u.v/=2,g(r[s],J,u));c("-- Step 2 done");var P,N;u=["123","12","2","23"];J=["123","23","3","31"];var F=["123","31","1","12"],L=["1234","12","2","23"],Q=["1234","23","3","34"],S=["1234","34","4","41"],M=["1234","41","1","12"];s=0;for(H=t.length;s<H;s++)y=p[s],A=q+s,y instanceof THREE.Face3?(K=m(y.a,y.b),B=m(y.b,y.c),
|
|
|
-P=m(y.c,y.a),e(A,r[K],y.b,r[B],y,u,s),e(A,r[B],y.c,r[P],y,J,s),e(A,r[P],y.a,r[K],y,F,s)):y instanceof THREE.Face4?(K=m(y.a,y.b),B=m(y.b,y.c),P=m(y.c,y.d),N=m(y.d,y.a),e(A,r[K],y.b,r[B],y,L,s),e(A,r[B],y.c,r[P],y,Q,s),e(A,r[P],y.d,r[N],y,S,s),e(A,r[N],y.a,r[K],y,M,s)):c("face should be a face!",y);r=new THREE.Vector3;y=new THREE.Vector3;s=0;for(H=o.length;s<H;s++)if(void 0!==I[s]){r.set(0,0,0);y.set(0,0,0);B=new THREE.Vector3(0,0,0);A=0;for(z in D[s])r.addSelf(t[z]),A++;J=0;K=I[s].length;u=A!=K;for(z=
|
|
|
-0;z<K;z++)C[m(I[s][z][0],I[s][z][1])]&&J++;r.divideScalar(A);J=0;if(u){for(z=0;z<K;z++)if(A=I[s][z],F=1==n[m(A[0],A[1])].length)A=o[A[0]].clone().addSelf(o[A[1]]).divideScalar(2),y.addSelf(A),J++;y.divideScalar(4);b(2==J,"should have only 2 boundary edges")}else{for(z=0;z<K;z++)A=I[s][z],A=o[A[0]].clone().addSelf(o[A[1]]).divideScalar(2),y.addSelf(A);y.divideScalar(K)}B.addSelf(o[s]);u?(B.divideScalar(2),B.addSelf(y)):(B.multiplyScalar(K-3),B.addSelf(r),B.addSelf(y.multiplyScalar(2)),B.divideScalar(K));
|
|
|
+1],o.r+=p.r,o.g+=p.g,o.b+=p.b;o.r/=q.length;o.g/=q.length;o.b/=q.length;n.vertexColors[r]=o}}i.push(n);l.supportUVs&&(g=[f(a,""),f(b,m),f(d,m),f(e,m)],g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",e+":"+m):c("c :( ",d+":"+m):c("b :( ",b+":"+m):c("a :( ",a+":"+m))}function f(a,b){var e=a+":"+b,f=y[e];return!f?(a>=q&&a<q+p.length?c("face pt"):c("edge pt"),d("warning, UV not found for",e),null):f}function g(a,b,c){var e=a+":"+b;e in y?d("dup vertexNo",a,"oldFaceNo",b,"value",c,"key",e,y[e]):y[e]=c}var h=[],
|
|
|
+i=[],j=[],l=this,m=THREE.GeometryUtils.orderedKey,n=THREE.GeometryUtils.computeEdgeFaces,o=a.vertices,p=a.faces,q=o.length,h=o.concat(),t=[],r={},C={},y={},s,H,z,v,u,D=a.faceVertexUvs[0],A;c("originalFaces, uvs, originalVerticesLength",p.length,D.length,q);if(l.supportUVs){s=0;for(H=D.length;s<H;s++){z=0;for(v=D[s].length;z<v;z++)A=p[s]["abcd".charAt(z)],g(A,s,D[s][z])}}0==D.length&&(l.supportUVs=!1);s=0;for(var I in y)s++;s||(l.supportUVs=!1,c("no uvs"));s=0;for(H=p.length;s<H;s++)u=p[s],t.push(u.centroid),
|
|
|
+h.push(u.centroid),l.supportUVs&&(v=new THREE.UV,u instanceof THREE.Face3?(v.u=f(u.a,s).u+f(u.b,s).u+f(u.c,s).u,v.v=f(u.a,s).v+f(u.b,s).v+f(u.c,s).v,v.u/=3,v.v/=3):u instanceof THREE.Face4&&(v.u=f(u.a,s).u+f(u.b,s).u+f(u.c,s).u+f(u.d,s).u,v.v=f(u.a,s).v+f(u.b,s).v+f(u.c,s).v+f(u.d,s).v,v.u/=4,v.v/=4),g(q+s,"",v));var n=n(a),J;H=0;var B,K;I={};D={};for(s in n){A=n[s];B=s.split("_");K=B[0];B=B[1];z=K;u=[K,B];void 0===I[z]&&(I[z]=[]);I[z].push(u);z=B;u=[K,B];void 0===I[z]&&(I[z]=[]);I[z].push(u);z=0;
|
|
|
+for(v=A.length;z<v;z++){u=A[z];J=K;var F=u,L=s;void 0===D[J]&&(D[J]={});D[J][F]=L;J=B;F=s;void 0===D[J]&&(D[J]={});D[J][u]=F}2>A.length&&(C[s]=!0)}for(s in n)if(A=n[s],u=A[0],J=A[1],B=s.split("_"),K=B[0],B=B[1],v=new THREE.Vector3,b(0<A.length,"an edge without faces?!"),1==A.length?(v.addSelf(o[K]),v.addSelf(o[B]),v.multiplyScalar(0.5)):(v.addSelf(t[u]),v.addSelf(t[J]),v.addSelf(o[K]),v.addSelf(o[B]),v.multiplyScalar(0.25)),r[s]=q+p.length+H,h.push(v),H++,l.supportUVs)v=new THREE.UV,v.u=f(K,u).u+
|
|
|
+f(B,u).u,v.v=f(K,u).v+f(B,u).v,v.u/=2,v.v/=2,g(r[s],u,v),2<=A.length&&(b(2==A.length,"did we plan for more than 2 edges?"),v=new THREE.UV,v.u=f(K,J).u+f(B,J).u,v.v=f(K,J).v+f(B,J).v,v.u/=2,v.v/=2,g(r[s],J,v));c("-- Step 2 done");var P,N;v=["123","12","2","23"];J=["123","23","3","31"];var F=["123","31","1","12"],L=["1234","12","2","23"],Q=["1234","23","3","34"],S=["1234","34","4","41"],M=["1234","41","1","12"];s=0;for(H=t.length;s<H;s++)u=p[s],A=q+s,u instanceof THREE.Face3?(K=m(u.a,u.b),B=m(u.b,u.c),
|
|
|
+P=m(u.c,u.a),e(A,r[K],u.b,r[B],u,v,s),e(A,r[B],u.c,r[P],u,J,s),e(A,r[P],u.a,r[K],u,F,s)):u instanceof THREE.Face4?(K=m(u.a,u.b),B=m(u.b,u.c),P=m(u.c,u.d),N=m(u.d,u.a),e(A,r[K],u.b,r[B],u,L,s),e(A,r[B],u.c,r[P],u,Q,s),e(A,r[P],u.d,r[N],u,S,s),e(A,r[N],u.a,r[K],u,M,s)):c("face should be a face!",u);r=new THREE.Vector3;u=new THREE.Vector3;s=0;for(H=o.length;s<H;s++)if(void 0!==I[s]){r.set(0,0,0);u.set(0,0,0);B=new THREE.Vector3(0,0,0);A=0;for(z in D[s])r.addSelf(t[z]),A++;J=0;K=I[s].length;v=A!=K;for(z=
|
|
|
+0;z<K;z++)C[m(I[s][z][0],I[s][z][1])]&&J++;r.divideScalar(A);J=0;if(v){for(z=0;z<K;z++)if(A=I[s][z],F=1==n[m(A[0],A[1])].length)A=o[A[0]].clone().addSelf(o[A[1]]).divideScalar(2),u.addSelf(A),J++;u.divideScalar(4);b(2==J,"should have only 2 boundary edges")}else{for(z=0;z<K;z++)A=I[s][z],A=o[A[0]].clone().addSelf(o[A[1]]).divideScalar(2),u.addSelf(A);u.divideScalar(K)}B.addSelf(o[s]);v?(B.divideScalar(2),B.addSelf(u)):(B.multiplyScalar(K-3),B.addSelf(r),B.addSelf(u.multiplyScalar(2)),B.divideScalar(K));
|
|
|
h[s]=B}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=j;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};
|
|
|
THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
@@ -731,32 +732,32 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
|
|
|
d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=0;d[o++]=1;o=0;e[o++]=0;e[o++]=1;e[o++]=2;e[o++]=0;e[o++]=2;e[o++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,l=a(THREE.ShaderFlares.lensFlare)):(j=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture));m={};n={};m.vertex=b.getAttribLocation(l,"position");m.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
|
|
|
-"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,t){var a=a.__webglFlares,r=a.length;if(r){var C=new THREE.Vector3,w=t/e,s=0.5*e,H=0.5*t,z=16/t,u=new THREE.Vector2(z*w,z),y=new THREE.Vector3(1,1,0),D=new THREE.Vector2(1,1),A=n,z=m;b.useProgram(l);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);b.uniform1i(A.occlusionMap,0);b.uniform1i(A.map,1);b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
-f);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var I,J,B,K,F;for(I=0;I<r;I++)if(z=16/t,u.set(z*w,z),K=a[I],C.set(K.matrixWorld.elements[12],K.matrixWorld.elements[13],K.matrixWorld.elements[14]),d.matrixWorldInverse.multiplyVector3(C),d.projectionMatrix.multiplyVector3(C),y.copy(C),D.x=y.x*s+s,D.y=y.y*H+H,j||0<D.x&&D.x<e&&0<D.y&&D.y<t){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,D.x-8,D.y-8,16,16,0);b.uniform1i(A.renderType,0);b.uniform2f(A.scale,u.x,u.y);b.uniform3f(A.screenPosition,y.x,y.y,y.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,D.x-8,D.y-8,16,16,0);b.uniform1i(A.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
-6,b.UNSIGNED_SHORT,0);K.positionScreen.copy(y);K.customUpdateCallback?K.customUpdateCallback(K):K.updateLensFlares();b.uniform1i(A.renderType,2);b.enable(b.BLEND);J=0;for(B=K.lensFlares.length;J<B;J++)F=K.lensFlares[J],0.001<F.opacity&&0.001<F.scale&&(y.x=F.x,y.y=F.y,y.z=F.z,z=F.size*F.scale/t,u.x=z*w,u.y=z,b.uniform3f(A.screenPosition,y.x,y.y,y.z),b.uniform2f(A.scale,u.x,u.y),b.uniform1f(A.rotation,F.rotation),b.uniform1f(A.opacity,F.opacity),b.uniform3f(A.color,F.color.r,F.color.g,F.color.b),c.setBlending(F.blending,
|
|
|
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,t){var a=a.__webglFlares,r=a.length;if(r){var C=new THREE.Vector3,y=t/e,s=0.5*e,H=0.5*t,z=16/t,v=new THREE.Vector2(z*y,z),u=new THREE.Vector3(1,1,0),D=new THREE.Vector2(1,1),A=n,z=m;b.useProgram(l);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);b.uniform1i(A.occlusionMap,0);b.uniform1i(A.map,1);b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
+f);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var I,J,B,K,F;for(I=0;I<r;I++)if(z=16/t,v.set(z*y,z),K=a[I],C.set(K.matrixWorld.elements[12],K.matrixWorld.elements[13],K.matrixWorld.elements[14]),d.matrixWorldInverse.multiplyVector3(C),d.projectionMatrix.multiplyVector3(C),u.copy(C),D.x=u.x*s+s,D.y=u.y*H+H,j||0<D.x&&D.x<e&&0<D.y&&D.y<t){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,D.x-8,D.y-8,16,16,0);b.uniform1i(A.renderType,0);b.uniform2f(A.scale,v.x,v.y);b.uniform3f(A.screenPosition,u.x,u.y,u.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,D.x-8,D.y-8,16,16,0);b.uniform1i(A.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
+6,b.UNSIGNED_SHORT,0);K.positionScreen.copy(u);K.customUpdateCallback?K.customUpdateCallback(K):K.updateLensFlares();b.uniform1i(A.renderType,2);b.enable(b.BLEND);J=0;for(B=K.lensFlares.length;J<B;J++)F=K.lensFlares[J],0.001<F.opacity&&0.001<F.scale&&(u.x=F.x,u.y=F.y,u.z=F.z,z=F.size*F.scale/t,v.x=z*y,v.y=z,b.uniform3f(A.screenPosition,u.x,u.y,u.z),b.uniform2f(A.scale,v.x,v.y),b.uniform1f(A.rotation,F.rotation),b.uniform1f(A.opacity,F.opacity),b.uniform3f(A.color,F.color.r,F.color.g,F.color.b),c.setBlending(F.blending,
|
|
|
F.blendEquation,F.blendSrc,F.blendDst),c.setTexture(F.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,j=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,m){var n,o,p,q,t,r,C,w,s,H=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces?
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,m){var n,o,p,q,t,r,C,y,s,H=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces?
|
|
|
a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);n=0;for(o=l.__lights.length;n<o;n++)if(p=l.__lights[n],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(t=0;t<p.shadowCascadeCount;t++){var z;if(p.shadowCascadeArray[t])z=p.shadowCascadeArray[t];else{s=p;C=t;z=new THREE.DirectionalLight;z.isVirtual=!0;z.onlyShadow=!0;z.castShadow=!0;z.shadowCameraNear=s.shadowCameraNear;z.shadowCameraFar=s.shadowCameraFar;z.shadowCameraLeft=s.shadowCameraLeft;z.shadowCameraRight=s.shadowCameraRight;
|
|
|
-z.shadowCameraBottom=s.shadowCameraBottom;z.shadowCameraTop=s.shadowCameraTop;z.shadowCameraVisible=s.shadowCameraVisible;z.shadowDarkness=s.shadowDarkness;z.shadowBias=s.shadowCascadeBias[C];z.shadowMapWidth=s.shadowCascadeWidth[C];z.shadowMapHeight=s.shadowCascadeHeight[C];z.pointsWorld=[];z.pointsFrustum=[];w=z.pointsWorld;r=z.pointsFrustum;for(var u=0;8>u;u++)w[u]=new THREE.Vector3,r[u]=new THREE.Vector3;w=s.shadowCascadeNearZ[C];s=s.shadowCascadeFarZ[C];r[0].set(-1,-1,w);r[1].set(1,-1,w);r[2].set(-1,
|
|
|
-1,w);r[3].set(1,1,w);r[4].set(-1,-1,s);r[5].set(1,-1,s);r[6].set(-1,1,s);r[7].set(1,1,s);z.originalCamera=m;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(z);r.add(z.target);m.add(r);p.shadowCascadeArray[t]=z;console.log("Created virtualLight",z)}C=p;w=t;s=C.shadowCascadeArray[w];s.position.copy(C.position);s.target.position.copy(C.target.position);s.lookAt(s.target);s.shadowCameraVisible=C.shadowCameraVisible;s.shadowDarkness=C.shadowDarkness;s.shadowBias=C.shadowCascadeBias[w];r=C.shadowCascadeNearZ[w];
|
|
|
-C=C.shadowCascadeFarZ[w];s=s.pointsFrustum;s[0].z=r;s[1].z=r;s[2].z=r;s[3].z=r;s[4].z=C;s[5].z=C;s[6].z=C;s[7].z=C;H[q]=z;q++}else H[q]=p,q++;n=0;for(o=H.length;n<o;n++){p=H[n];p.shadowMap||(p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=
|
|
|
+z.shadowCameraBottom=s.shadowCameraBottom;z.shadowCameraTop=s.shadowCameraTop;z.shadowCameraVisible=s.shadowCameraVisible;z.shadowDarkness=s.shadowDarkness;z.shadowBias=s.shadowCascadeBias[C];z.shadowMapWidth=s.shadowCascadeWidth[C];z.shadowMapHeight=s.shadowCascadeHeight[C];z.pointsWorld=[];z.pointsFrustum=[];y=z.pointsWorld;r=z.pointsFrustum;for(var v=0;8>v;v++)y[v]=new THREE.Vector3,r[v]=new THREE.Vector3;y=s.shadowCascadeNearZ[C];s=s.shadowCascadeFarZ[C];r[0].set(-1,-1,y);r[1].set(1,-1,y);r[2].set(-1,
|
|
|
+1,y);r[3].set(1,1,y);r[4].set(-1,-1,s);r[5].set(1,-1,s);r[6].set(-1,1,s);r[7].set(1,1,s);z.originalCamera=m;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(z);r.add(z.target);m.add(r);p.shadowCascadeArray[t]=z;console.log("Created virtualLight",z)}C=p;y=t;s=C.shadowCascadeArray[y];s.position.copy(C.position);s.target.position.copy(C.target.position);s.lookAt(s.target);s.shadowCameraVisible=C.shadowCameraVisible;s.shadowDarkness=C.shadowDarkness;s.shadowBias=C.shadowCascadeBias[y];r=C.shadowCascadeNearZ[y];
|
|
|
+C=C.shadowCascadeFarZ[y];s=s.pointsFrustum;s[0].z=r;s[1].z=r;s[2].z=r;s[3].z=r;s[4].z=C;s[5].z=C;s[6].z=C;s[7].z=C;H[q]=z;q++}else H[q]=p,q++;n=0;for(o=H.length;n<o;n++){p=H[n];p.shadowMap||(p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=
|
|
|
new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(p.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}p.shadowCameraVisible&&!p.cameraHelper&&(p.cameraHelper=
|
|
|
-new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&z.originalCamera==m){t=m;q=p.shadowCamera;r=p.pointsFrustum;s=p.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(C=0;8>C;C++)if(w=s[C],w.copy(r[C]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,t),q.matrixWorldInverse.multiplyVector3(w),w.x<i.x&&(i.x=w.x),w.x>j.x&&(j.x=w.x),w.y<i.y&&(i.y=w.y),w.y>j.y&&(j.y=w.y),w.z<i.z&&(i.z=w.z),w.z>j.z)j.z=w.z;q.left=i.x;q.right=
|
|
|
+new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&z.originalCamera==m){t=m;q=p.shadowCamera;r=p.pointsFrustum;s=p.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(C=0;8>C;C++)if(y=s[C],y.copy(r[C]),THREE.ShadowMapPlugin.__projector.unprojectVector(y,t),q.matrixWorldInverse.multiplyVector3(y),y.x<i.x&&(i.x=y.x),y.x>j.x&&(j.x=y.x),y.y<i.y&&(i.y=y.y),y.y>j.y&&(j.y=y.y),y.z<i.z&&(i.z=y.z),y.z>j.z)j.z=y.z;q.left=i.x;q.right=
|
|
|
j.x;q.top=j.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;r=p.shadowMatrix;t=p.shadowCamera;t.position.copy(p.matrixWorld.getPosition());t.lookAt(p.target.matrixWorld.getPosition());t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(t.projectionMatrix);r.multiplySelf(t.matrixWorldInverse);t._viewMatrixArray||
|
|
|
(t._viewMatrixArray=new Float32Array(16));t._projectionMatrixArray||(t._projectionMatrixArray=new Float32Array(16));t.matrixWorldInverse.flattenToArray(t._viewMatrixArray);t.projectionMatrix.flattenToArray(t._projectionMatrixArray);h.multiply(t.projectionMatrix,t.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();s=l.__webglObjects;p=0;for(q=s.length;p<q;p++)if(C=s[p],r=C.object,C.render=!1,r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||
|
|
|
-!r.frustumCulled||g.contains(r)))r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld),C.render=!0;p=0;for(q=s.length;p<q;p++)C=s[p],C.render&&(r=C.object,C=C.buffer,u=r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material,w=0<r.geometry.morphTargets.length&&u.morphTargets,u=r instanceof THREE.SkinnedMesh&&u.skinning,w=r.customDepthMaterial?r.customDepthMaterial:u?w?f:e:w?d:c,C instanceof THREE.BufferGeometry?b.renderBufferDirect(t,l.__lights,null,w,C,r):b.renderBuffer(t,
|
|
|
-l.__lights,null,w,C,r));s=l.__webglObjectsImmediate;p=0;for(q=s.length;p<q;p++)C=s[p],r=C.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld),b.renderImmediateObject(t,l.__lights,null,c,r))}n=b.getClearColor();o=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
+!r.frustumCulled||g.contains(r)))r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld),C.render=!0;p=0;for(q=s.length;p<q;p++)C=s[p],C.render&&(r=C.object,C=C.buffer,v=r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material,y=0<r.geometry.morphTargets.length&&v.morphTargets,v=r instanceof THREE.SkinnedMesh&&v.skinning,y=r.customDepthMaterial?r.customDepthMaterial:v?y?f:e:y?d:c,C instanceof THREE.BufferGeometry?b.renderBufferDirect(t,l.__lights,null,y,C,r):b.renderBuffer(t,
|
|
|
+l.__lights,null,y,C,r));s=l.__webglObjectsImmediate;p=0;for(q=s.length;p<q;p++)C=s[p],r=C.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld),b.renderImmediateObject(t,l.__lights,null,c,r))}n=b.getClearColor();o=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=0;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);
|
|
|
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),o=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(o,a.vertexShader);b.compileShader(n);b.compileShader(o);b.attachShader(m,n);b.attachShader(m,o);b.linkProgram(m);h=m;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,
|
|
|
"uvOffset");j.uvScale=b.getUniformLocation(h,"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");
|
|
|
-j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j.fogType=b.getUniformLocation(h,"fogType");j.fogDensity=b.getUniformLocation(h,"fogDensity");j.fogNear=b.getUniformLocation(h,"fogNear");j.fogFar=b.getUniformLocation(h,"fogFar");j.fogColor=b.getUniformLocation(h,"fogColor");j.alphaTest=b.getUniformLocation(h,"alphaTest")};this.render=function(d,e,n,o){var p=d.__webglSprites,q=p.length;if(q){var t=i,r=j,C=o/n,n=0.5*n,w=0.5*o,
|
|
|
+j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j.fogType=b.getUniformLocation(h,"fogType");j.fogDensity=b.getUniformLocation(h,"fogDensity");j.fogNear=b.getUniformLocation(h,"fogNear");j.fogFar=b.getUniformLocation(h,"fogFar");j.fogColor=b.getUniformLocation(h,"fogColor");j.alphaTest=b.getUniformLocation(h,"alphaTest")};this.render=function(d,e,n,o){var p=d.__webglSprites,q=p.length;if(q){var t=i,r=j,C=o/n,n=0.5*n,y=0.5*o,
|
|
|
s=!0;b.useProgram(h);b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(r.projectionMatrix,!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);var H=t=0,z=d.fog;z?(b.uniform3f(r.fogColor,z.color.r,z.color.g,z.color.b),
|
|
|
-z instanceof THREE.Fog?(b.uniform1f(r.fogNear,z.near),b.uniform1f(r.fogFar,z.far),b.uniform1i(r.fogType,1),H=t=1):z instanceof THREE.FogExp2&&(b.uniform1f(r.fogDensity,z.density),b.uniform1i(r.fogType,2),H=t=2)):(b.uniform1i(r.fogType,0),H=t=0);for(var u,y=[],z=0;z<q;z++)u=p[z],u.visible&&0!==u.opacity&&(u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiply(e.matrixWorldInverse,u.matrixWorld),u.z=-u._modelViewMatrix.elements[14]));p.sort(a);for(z=0;z<q;z++)if(u=p[z],u.visible&&0!==
|
|
|
-u.opacity&&u.map&&u.map.image&&u.map.image.width)b.uniform1f(r.alphaTest,u.alphaTest),u.useScreenCoordinates?(b.uniform1i(r.useScreenCoordinates,1),b.uniform3f(r.screenPosition,(u.position.x-n)/n,(w-u.position.y)/w,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(r.useScreenCoordinates,0),b.uniform1i(r.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(r.modelViewMatrix,!1,u._modelViewMatrix.elements)),e=d.fog&&u.fog?H:0,t!==e&&(b.uniform1i(r.fogType,e),t=e),e=1/(u.scaleByViewport?
|
|
|
-o:1),y[0]=e*C*u.scale.x,y[1]=e*u.scale.y,b.uniform2f(r.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(r.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(r.alignment,u.alignment.x,u.alignment.y),b.uniform1f(r.opacity,u.opacity),b.uniform3f(r.color,u.color.r,u.color.g,u.color.b),b.uniform1f(r.rotation,u.rotation),b.uniform2fv(r.scale,y),u.mergeWith3D&&!s?(b.enable(b.DEPTH_TEST),s=!0):!u.mergeWith3D&&s&&(b.disable(b.DEPTH_TEST),s=!1),c.setBlending(u.blending,u.blendEquation,u.blendSrc,u.blendDst),c.setTexture(u.map,
|
|
|
-0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
+z instanceof THREE.Fog?(b.uniform1f(r.fogNear,z.near),b.uniform1f(r.fogFar,z.far),b.uniform1i(r.fogType,1),H=t=1):z instanceof THREE.FogExp2&&(b.uniform1f(r.fogDensity,z.density),b.uniform1i(r.fogType,2),H=t=2)):(b.uniform1i(r.fogType,0),H=t=0);for(var v,u,D=[],z=0;z<q;z++)v=p[z],u=v.material,v.visible&&0!==u.opacity&&(u.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiply(e.matrixWorldInverse,v.matrixWorld),v.z=-v._modelViewMatrix.elements[14]));p.sort(a);for(z=0;z<q;z++)if(v=p[z],
|
|
|
+u=v.material,v.visible&&0!==u.opacity&&u.map&&u.map.image&&u.map.image.width)b.uniform1f(r.alphaTest,u.alphaTest),u.useScreenCoordinates?(b.uniform1i(r.useScreenCoordinates,1),b.uniform3f(r.screenPosition,(v.position.x-n)/n,(y-v.position.y)/y,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(r.useScreenCoordinates,0),b.uniform1i(r.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(r.modelViewMatrix,!1,v._modelViewMatrix.elements)),e=d.fog&&u.fog?H:0,t!==e&&(b.uniform1i(r.fogType,e),
|
|
|
+t=e),e=1/(u.scaleByViewport?o:1),D[0]=e*C*v.scale.x,D[1]=e*v.scale.y,b.uniform2f(r.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(r.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(r.alignment,u.alignment.x,u.alignment.y),b.uniform1f(r.opacity,u.opacity),b.uniform3f(r.color,u.color.r,u.color.g,u.color.b),b.uniform1f(r.rotation,v.rotation),b.uniform2fv(r.scale,D),u.mergeWith3D&&!s?(b.enable(b.DEPTH_TEST),s=!0):!u.mergeWith3D&&s&&(b.disable(b.DEPTH_TEST),s=!1),c.setBlending(u.blending,u.blendEquation,
|
|
|
+u.blendSrc,u.blendDst),c.setTexture(u.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,j){var l,m,n,o,p,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();j._viewMatrixArray||(j._viewMatrixArray=new Float32Array(16));
|
|
|
j._projectionMatrixArray||(j._projectionMatrixArray=new Float32Array(16));j.matrixWorldInverse.getInverse(j.matrixWorld);j.matrixWorldInverse.flattenToArray(j._viewMatrixArray);j.projectionMatrix.flattenToArray(j._projectionMatrixArray);h.multiply(j.projectionMatrix,j.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();q=i.__webglObjects;l=0;for(m=q.length;l<m;l++)if(n=q[l],p=n.object,n.render=!1,p.visible&&(!(p instanceof THREE.Mesh||p instanceof THREE.ParticleSystem)||
|