|
@@ -29,7 +29,7 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,k,l,
|
|
|
b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
|
|
|
a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
|
|
|
c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44,z=b.n11,C=b.n12,
|
|
|
-B=b.n13,K=b.n14,F=b.n21,M=b.n22,E=b.n23,O=b.n24,V=b.n31,H=b.n32,P=b.n33,L=b.n34,T=b.n41,S=b.n42,m=b.n43,aa=b.n44;this.n11=c*z+e*F+f*V+h*T;this.n12=c*C+e*M+f*H+h*S;this.n13=c*B+e*E+f*P+h*m;this.n14=c*K+e*O+f*L+h*aa;this.n21=k*z+l*F+n*V+p*T;this.n22=k*C+l*M+n*H+p*S;this.n23=k*B+l*E+n*P+p*m;this.n24=k*K+l*O+n*L+p*aa;this.n31=u*z+t*F+v*V+o*T;this.n32=u*C+t*M+v*H+o*S;this.n33=u*B+t*E+v*P+o*m;this.n34=u*K+t*O+v*L+o*aa;this.n41=y*z+x*F+w*V+A*T;this.n42=y*C+x*M+w*H+A*S;this.n43=y*B+x*E+w*P+A*m;this.n44=y*
|
|
|
+B=b.n13,K=b.n14,F=b.n21,M=b.n22,E=b.n23,O=b.n24,V=b.n31,I=b.n32,P=b.n33,L=b.n34,T=b.n41,S=b.n42,m=b.n43,aa=b.n44;this.n11=c*z+e*F+f*V+h*T;this.n12=c*C+e*M+f*I+h*S;this.n13=c*B+e*E+f*P+h*m;this.n14=c*K+e*O+f*L+h*aa;this.n21=k*z+l*F+n*V+p*T;this.n22=k*C+l*M+n*I+p*S;this.n23=k*B+l*E+n*P+p*m;this.n24=k*K+l*O+n*L+p*aa;this.n31=u*z+t*F+v*V+o*T;this.n32=u*C+t*M+v*I+o*S;this.n33=u*B+t*E+v*P+o*m;this.n34=u*K+t*O+v*L+o*aa;this.n41=y*z+x*F+w*V+A*T;this.n42=y*C+x*M+w*I+A*S;this.n43=y*B+x*E+w*P+A*m;this.n44=y*
|
|
|
K+x*O+w*L+A*aa;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=
|
|
|
a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,k=this.n23,l=this.n24,n=this.n31,p=this.n32,u=this.n33,t=this.n34,v=this.n41,o=this.n42,y=this.n43,x=this.n44;return e*k*p*v-c*l*p*v-e*h*u*v+b*l*u*v+c*h*t*v-b*k*t*v-e*k*n*o+c*l*n*o+e*f*u*o-a*l*u*o-c*f*t*o+a*k*t*o+e*h*n*y-b*l*n*y-e*f*p*y+a*l*p*y+b*f*t*y-a*h*t*y-c*h*n*x+b*k*n*x+c*f*p*x-a*k*p*x-b*f*
|
|
|
u*x+a*h*u*x},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=
|
|
@@ -57,7 +57,7 @@ a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:fu
|
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
|
|
|
this.remove(a)}};THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function a(){var a=n[l]=n[l]||new THREE.RenderableVertex;l++;return a}function b(a,c){return c.z-a.z}function c(a,c){var b=0,e=1,f=a.z+a.w,k=c.z+c.w,h=-a.z+a.w,l=-c.z+c.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<b?!1:(a.lerpSelf(c,b),c.lerpSelf(a,1-e),!0))}var e,f,h=[],k,l,n=[],p,u,t=[],v,o=[],y,x,w=[],A,z,C=[],B=[],K=[],F=new THREE.Vector4,M=new THREE.Vector4,
|
|
|
-E=new THREE.Matrix4,O=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
|
|
|
+E=new THREE.Matrix4,O=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
|
|
|
a.y,1);this.unprojectVector(a,c);this.unprojectVector(b,c);b.subSelf(a).normalize();return new THREE.Ray(a,b)};this.projectObjects=function(a,c,k){var m,l;f=B.length=0;m=a.objects;a=0;for(c=m.length;a<c;a++){l=m[a];var n;if(!(n=!l.visible))if(n=l instanceof THREE.Mesh)if(n=l.frustumCulled){a:{n=void 0;for(var p=l.matrixWorld,o=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),t=0;t<6;t++)if(n=V[t].x*p.n14+V[t].y*p.n24+V[t].z*p.n34+V[t].w,n<=o){n=!1;break a}n=!0}n=
|
|
|
!n}if(!n)n=h[f]=h[f]||new THREE.RenderableObject,f++,e=n,F.copy(l.position),E.multiplyVector3(F),e.object=l,e.z=F.z,B.push(e)}k&&B.sort(b);return B};this.projectScene=function(e,f,h){var m=f.near,B=f.far,F,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa,na,fa,qa,la;z=x=v=u=K.length=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);E.multiply(f.projectionMatrix,f.matrixWorldInverse);V[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);V[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);V[2].set(E.n41+
|
|
|
E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);V[3].set(E.n41-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);V[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);V[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(F=0;F<6;F++)R=V[F],R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z));R=this.projectObjects(e,f,!0);e=0;for(F=R.length;e<F;e++)if(Y=R[e].object,Y.visible)if(X=Y.matrixWorld,ga=Y.matrixRotationWorld,oa=Y.materials,na=Y.overdraw,l=0,Y instanceof THREE.Mesh){fa=Y.geometry;ia=fa.vertices;
|
|
@@ -65,7 +65,7 @@ qa=fa.faces;fa=fa.faceVertexUvs;ea=0;for(da=ia.length;ea<da;ea++)k=a(),k.positio
|
|
|
Y.flipSided!=(ca.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0))Z=t[u]=t[u]||new THREE.RenderableFace3,u++,p=Z,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca);else continue;else if(da instanceof THREE.Face4)if(ha=n[da.a],ja=n[da.b],ca=n[da.c],Z=n[da.d],ha.visible&&ja.visible&&ca.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-
|
|
|
ha.positionScreen.y)-(Z.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0||(ja.positionScreen.x-ca.positionScreen.x)*(Z.positionScreen.y-ca.positionScreen.y)-(ja.positionScreen.y-ca.positionScreen.y)*(Z.positionScreen.x-ca.positionScreen.x)<0)))la=o[v]=o[v]||new THREE.RenderableFace4,v++,p=la,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca),p.v4.copy(Z);else continue;p.normalWorld.copy(da.normal);ga.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);X.multiplyVector3(p.centroidWorld);
|
|
|
p.centroidScreen.copy(p.centroidWorld);E.multiplyVector3(p.centroidScreen);ca=da.vertexNormals;ha=0;for(ja=ca.length;ha<ja;ha++)Z=p.vertexNormalsWorld[ha],Z.copy(ca[ha]),ga.multiplyVector3(Z);ha=0;for(ja=fa.length;ha<ja;ha++)if(la=fa[ha][ia]){ca=0;for(Z=la.length;ca<Z;ca++)p.uvs[ha][ca]=la[ca]}p.meshMaterials=oa;p.faceMaterials=da.materials;p.overdraw=na;p.z=p.centroidScreen.z;K.push(p)}}else if(Y instanceof THREE.Line){O.multiply(E,X);ia=Y.geometry.vertices;ha=a();ha.positionScreen.copy(ia[0].position);
|
|
|
-O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),ha.positionScreen.copy(ia[ea].position),O.multiplyVector4(ha.positionScreen),ja=n[l-2],H.copy(ha.positionScreen),P.copy(ja.positionScreen),c(H,P))H.multiplyScalar(1/H.w),P.multiplyScalar(1/P.w),X=w[x]=w[x]||new THREE.RenderableLine,x++,y=X,y.v1.positionScreen.copy(H),y.v2.positionScreen.copy(P),y.z=Math.max(H.z,P.z),y.materials=Y.materials,K.push(y)}else if(Y instanceof THREE.Particle&&(M.set(Y.matrixWorld.n14,Y.matrixWorld.n24,
|
|
|
+O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),ha.positionScreen.copy(ia[ea].position),O.multiplyVector4(ha.positionScreen),ja=n[l-2],I.copy(ha.positionScreen),P.copy(ja.positionScreen),c(I,P))I.multiplyScalar(1/I.w),P.multiplyScalar(1/P.w),X=w[x]=w[x]||new THREE.RenderableLine,x++,y=X,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(P),y.z=Math.max(I.z,P.z),y.materials=Y.materials,K.push(y)}else if(Y instanceof THREE.Particle&&(M.set(Y.matrixWorld.n14,Y.matrixWorld.n24,
|
|
|
Y.matrixWorld.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
|
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
@@ -81,8 +81,8 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
|
|
|
c,e,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),n.sub(b.position,c.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
|
Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
|
|
|
THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
|
|
|
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P);
|
|
|
-V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],H=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,V[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var m=["a","b",
|
|
|
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);I.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(I);O[b].addSelf(I);O[e].addSelf(I);V[c].addSelf(P);
|
|
|
+V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],I=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,V[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var m=["a","b",
|
|
|
"c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)S.copy(h.vertexNormals[e]),f=h[m[e]],E=O[f],L.copy(E),L.subSelf(S.multiplyScalar(S.dot(E))).normalize(),T.cross(h.vertexNormals[e],E),f=T.dot(V[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
|
a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
|
|
@@ -153,7 +153,7 @@ THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addCh
|
|
|
THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,f,h;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;e=b;f=c/2;h=e/2};this.render=function(c,e){var n,p,u,t,v,o,y,x;a=b.projectScene(c,e);n=0;for(p=a.length;n<p;n++)if(v=a[n],v instanceof THREE.RenderableParticle){y=v.x*f+f;x=v.y*h+h;u=0;for(t=v.material.length;u<t;u++)if(o=v.material[u],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=y+"px",o.style.top=x+"px"}}};
|
|
|
THREE.CanvasRenderer=function(a){function b(a){if(w!=a)o.globalAlpha=w=a}function c(a){if(A!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}A=a}}function e(a){if(z!=a)o.strokeStyle=z=a}function f(a){if(C!=a)o.fillStyle=C=a}var h=this,k=null,l=new THREE.Projector,a=a||{},n=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-p,u,t,v,o=n.getContext("2d"),y=new THREE.Color(0),x=0,w=1,A=0,z=null,C=null,B=null,K=null,F=null,M,E,O,V,H=new THREE.RenderableVertex,P=new THREE.RenderableVertex,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z=new THREE.Color(0),R=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),oa=[],na,fa,qa,la,ua,sa,Da,Ea,za,Fa,xa=new THREE.Rectangle,G=new THREE.Rectangle,$=new THREE.Rectangle,ma=!1,I=new THREE.Color,N=new THREE.Color,ta=new THREE.Color,pa=new THREE.Color,ka=new THREE.Vector3,
|
|
|
+p,u,t,v,o=n.getContext("2d"),y=new THREE.Color(0),x=0,w=1,A=0,z=null,C=null,B=null,K=null,F=null,M,E,O,V,I=new THREE.RenderableVertex,P=new THREE.RenderableVertex,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z=new THREE.Color(0),R=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),oa=[],na,fa,qa,la,ua,sa,Da,Ea,za,Fa,xa=new THREE.Rectangle,G=new THREE.Rectangle,$=new THREE.Rectangle,ma=!1,H=new THREE.Color,N=new THREE.Color,ta=new THREE.Color,pa=new THREE.Color,ka=new THREE.Vector3,
|
|
|
ya,va,Ca,Ba,Ga,W,a=16;ya=document.createElement("canvas");ya.width=ya.height=2;va=ya.getContext("2d");va.fillStyle="rgba(0,0,0,1)";va.fillRect(0,0,2,2);Ca=va.getImageData(0,0,2,2);Ba=Ca.data;Ga=document.createElement("canvas");Ga.width=Ga.height=a;W=Ga.getContext("2d");W.translate(-a/2,-a/2);W.scale(a,a);a--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,c){p=a;u=c;t=Math.floor(p/2);v=Math.floor(u/2);n.width=p;
|
|
|
n.height=u;xa.set(-t,-v,t,v);G.set(-t,-v,t,v);w=1;A=0;F=K=B=C=z=null};this.setClearColor=function(a,c){y.copy(a);x=c;G.set(-t,-v,t,v)};this.setClearColorHex=function(a,c){y.setHex(a);x=c;G.set(-t,-v,t,v)};this.clear=function(){o.setTransform(1,0,0,-1,t,v);G.isEmpty()||(G.minSelf(xa),G.inflate(2),x<1&&o.clearRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+
|
|
|
Math.floor(y.b*255)+","+x+")"),o.fillRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight()))),G.empty())};this.render=function(a,n){function p(a){var c,b,e,f=a.lights;N.setRGB(0,0,0);ta.setRGB(0,0,0);pa.setRGB(0,0,0);a=0;for(c=f.length;a<c;a++)b=f[a],e=b.color,b instanceof THREE.AmbientLight?(N.r+=e.r,N.g+=e.g,N.b+=e.b):b instanceof THREE.DirectionalLight?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):b instanceof THREE.PointLight&&(pa.r+=e.r,pa.g+=e.g,pa.b+=e.b)}function u(a,
|
|
@@ -163,13 +163,13 @@ o.restore()))}function w(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.mov
|
|
|
L=a.positionScreen.x;T=a.positionScreen.y;S=e.positionScreen.x;m=e.positionScreen.y;aa=f.positionScreen.x;U=f.positionScreen.y;A(L,T,S,m,aa,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,ka.copy(t.vertexNormalsWorld[0]),ua=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,
|
|
|
sa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[1]),Da=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Ea=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[2]),za=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Fa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,$a(L,T,S,m,aa,U,ua,sa,Da,Ea,za,Fa,o.envMap)}else o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&
|
|
|
(o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map)),c(THREE.SubtractiveBlending)),ma?!o.wireframe&&o.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(R.r=Y.r=X.r=N.r,R.g=Y.g=X.g=N.g,R.b=Y.b=X.b=N.b,u(v,t.v1.positionWorld,t.vertexNormalsWorld[0],R),u(v,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),u(v,t.v3.positionWorld,t.vertexNormalsWorld[2],X),R.r=Math.max(0,Math.min(o.color.r*R.r,1)),R.g=Math.max(0,Math.min(o.color.g*
|
|
|
-R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,t.centroidWorld,t.normalWorld,I),Z.r=Math.max(0,Math.min(o.color.r*
|
|
|
-I.r,1)),Z.g=Math.max(0,Math.min(o.color.g*I.g,1)),Z.b=Math.max(0,Math.min(o.color.b*I.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,
|
|
|
+R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(H.r=N.r,H.g=N.g,H.b=N.b,u(v,t.centroidWorld,t.normalWorld,H),Z.r=Math.max(0,Math.min(o.color.r*
|
|
|
+H.r,1)),Z.g=Math.max(0,Math.min(o.color.g*H.g,1)),Z.b=Math.max(0,Math.min(o.color.b*H.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,
|
|
|
ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(t.normalWorld.x),Z.g=Va(t.normalWorld.y),Z.b=Va(t.normalWorld.z),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)}function z(a,e,f,k,l,p,o,t,v){h.info.render.vertices+=4;h.info.render.faces++;b(t.opacity);c(t.blending);if(t.map||t.envMap)y(a,e,k,0,1,3,o,t,v),y(l,f,p,1,2,3,o,t,v);else if(L=a.positionScreen.x,T=a.positionScreen.y,S=e.positionScreen.x,
|
|
|
m=e.positionScreen.y,aa=f.positionScreen.x,U=f.positionScreen.y,ea=k.positionScreen.x,da=k.positionScreen.y,ia=l.positionScreen.x,ha=l.positionScreen.y,ja=p.positionScreen.x,ca=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)ma?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(R.r=Y.r=X.r=ga.r=N.r,R.g=
|
|
|
Y.g=X.g=ga.g=N.g,R.b=Y.b=X.b=ga.b=N.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],R),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],Y),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],X),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),R.r=Math.max(0,Math.min(t.color.r*R.r,1)),R.g=Math.max(0,Math.min(t.color.g*R.g,1)),R.b=Math.max(0,Math.min(t.color.b*R.b,1)),Y.r=Math.max(0,Math.min(t.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(t.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(t.color.b*Y.b,1)),X.r=Math.max(0,
|
|
|
-Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,o.centroidWorld,o.normalWorld,I),Z.r=Math.max(0,Math.min(t.color.r*I.r,1)),Z.g=Math.max(0,Math.min(t.color.g*
|
|
|
-I.g,1)),Z.b=Math.max(0,Math.min(t.color.b*I.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z);
|
|
|
+Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(H.r=N.r,H.g=N.g,H.b=N.b,u(v,o.centroidWorld,o.normalWorld,H),Z.r=Math.max(0,Math.min(t.color.r*H.r,1)),Z.g=Math.max(0,Math.min(t.color.g*
|
|
|
+H.g,1)),Z.b=Math.max(0,Math.min(t.color.b*H.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z);
|
|
|
else if(t instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(k.positionScreen.z,na,fa),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,na,fa),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)}function A(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function C(a,c,b,e,f,k,h,m){o.beginPath();
|
|
|
o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,m);o.lineTo(a,c);o.closePath()}function Ka(a,c,b,f){if(B!=c)o.lineWidth=B=c;if(K!=b)o.lineCap=K=b;if(F!=f)o.lineJoin=F=f;e(a.getContextStyle());o.stroke();$.inflate(c*2)}function La(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,m,l,n,p,t,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||oa[v.id]==void 0){var wa=v.wrapS==THREE.RepeatWrapping,G=v.wrapT==THREE.RepeatWrapping;oa[v.id]=o.createPattern(v.image,wa&&G?"repeat":wa&&!G?"repeat-x":
|
|
|
!wa&&G?"repeat-y":"no-repeat");v.needsUpdate=!1}f(oa[v.id]);var wa=v.offset.x/v.repeat.x,G=v.offset.y/v.repeat.y,x=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,m=(m+wa)*x,l=(l+G)*v,n=(n+wa)*x,p=(p+G)*v,t=(t+wa)*x,u=(u+G)*v;b-=a;e-=c;k-=a;h-=c;n-=m;p-=l;t-=m;u-=l;wa=1/(n*u-t*p);v=(u*b-p*k)*wa;p=(u*e-p*h)*wa;b=(n*k-t*b)*wa;e=(n*h-t*e)*wa;a=a-v*m-b*l;c=c-p*m-e*l;o.save();o.transform(v,p,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,m,l,n,p,t,v){var u,wa;u=v.width-1;wa=v.height-
|
|
@@ -178,22 +178,22 @@ a>255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=m<0?0:m>255?255:m;Ba[6]=c<0?0:c>255?25
|
|
|
ab,ra,Ha,Na,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,t,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,n,this.sortElements);(ma=a.lights.length>0)&&p(a);Ya=0;for(ab=k.length;Ya<ab;Ya++){ra=k[Ya];$.empty();if(ra instanceof THREE.RenderableParticle){M=ra;M.x*=t;M.y*=v;Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&x(M,ra,Aa,a)}else if(ra instanceof THREE.RenderableLine){if(M=ra.v1,E=ra.v2,M.positionScreen.x*=t,M.positionScreen.y*=
|
|
|
v,E.positionScreen.x*=t,E.positionScreen.y*=v,$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&w(M,E,ra,Aa,a)}}else if(ra instanceof THREE.RenderableFace3){if(M=ra.v1,E=ra.v2,O=ra.v3,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),
|
|
|
Ma(E.positionScreen,O.positionScreen),Ma(O.positionScreen,M.positionScreen)),$.add3Points(M.positionScreen.x,M.positionScreen.y,E.positionScreen.x,E.positionScreen.y,O.positionScreen.x,O.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}else Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}}else if(ra instanceof
|
|
|
-THREE.RenderableFace4&&(M=ra.v1,E=ra.v2,O=ra.v3,V=ra.v4,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,H.positionScreen.copy(E.positionScreen),P.positionScreen.copy(V.positionScreen),ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),Ma(E.positionScreen,V.positionScreen),Ma(V.positionScreen,M.positionScreen),Ma(O.positionScreen,H.positionScreen),Ma(O.positionScreen,P.positionScreen)),
|
|
|
-$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(O.positionScreen.x,O.positionScreen.y),$.addPoint(V.positionScreen.x,V.positionScreen.y),xa.intersects($))){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}else Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}G.addRectangle($)}o.setTransform(1,
|
|
|
+THREE.RenderableFace4&&(M=ra.v1,E=ra.v2,O=ra.v3,V=ra.v4,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,I.positionScreen.copy(E.positionScreen),P.positionScreen.copy(V.positionScreen),ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),Ma(E.positionScreen,V.positionScreen),Ma(V.positionScreen,M.positionScreen),Ma(O.positionScreen,I.positionScreen),Ma(O.positionScreen,P.positionScreen)),
|
|
|
+$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(O.positionScreen.x,O.positionScreen.y),$.addPoint(V.positionScreen.x,V.positionScreen.y),xa.intersects($))){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&z(M,E,O,V,I,P,ra,Aa,a)}else Aa.opacity!=0&&z(M,E,O,V,I,P,ra,Aa,a)}G.addRectangle($)}o.setTransform(1,
|
|
|
0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function a(a,c,b){var e,f,k,h;e=0;for(f=a.lights.length;e<f;e++)k=a.lights[e],k instanceof THREE.DirectionalLight?(h=c.normalWorld.dot(k.position)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(V.sub(k.position,c.centroidWorld),V.normalize(),h=c.normalWorld.dot(V)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,m,l,p){h.info.render.vertices+=3;h.info.render.faces++;L=e(T++);
|
|
|
L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?B.copy(l.color):l instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(p,m,K),B.r=Math.max(0,Math.min(l.color.r*K.r,1)),B.g=Math.max(0,Math.min(l.color.g*K.g,1)),B.b=Math.max(0,Math.min(l.color.b*K.b,1))):B.copy(l.color):l instanceof THREE.MeshDepthMaterial?(O=1-l.__2near/(l.__farPlusNear-
|
|
|
m.z*l.__farMinusNear),B.setRGB(O,O,O)):l instanceof THREE.MeshNormalMaterial&&B.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));l.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+l.opacity);n.appendChild(L)}function c(c,b,k,m,l,p,t){h.info.render.vertices+=
|
|
|
4;h.info.render.faces++;L=e(T++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?B.copy(p.color):p instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(t,l,K),B.r=Math.max(0,Math.min(p.color.r*K.r,1)),B.g=Math.max(0,Math.min(p.color.g*K.g,1)),B.b=Math.max(0,Math.min(p.color.b*K.b,1))):
|
|
|
B.copy(p.color):p instanceof THREE.MeshDepthMaterial?(O=1-p.__2near/(p.__farPlusNear-l.z*p.__farMinusNear),B.setRGB(O,O,O)):p instanceof THREE.MeshNormalMaterial&&B.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));p.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+
|
|
|
-"; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0),
|
|
|
-M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,H=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
|
|
|
-this.render=function(a,e){var f,p,u,B,O,H,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f<p;f++)u=K[f],B=u.color,u instanceof THREE.AmbientLight?(F.r+=B.r,F.g+=B.g,F.b+=B.b):u instanceof THREE.DirectionalLight?(M.r+=B.r,M.g+=B.g,M.b+=B.b):u instanceof THREE.PointLight&&(E.r+=B.r,E.g+=B.g,E.b+=B.b)}f=0;for(p=k.length;f<
|
|
|
-p;f++)if(K=k[f],z.empty(),K instanceof THREE.RenderableParticle){o=K;o.x*=t;o.y*=-v;u=0;for(B=K.materials.length;u<B;)u++}else if(K instanceof THREE.RenderableLine){if(o=K.v1,y=K.v2,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(z)){u=0;for(B=K.materials.length;u<B;)if((R=K.materials[u++])&&R.opacity!=0){O=o;H=y;var Y=S++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),m==0&&P[Y].setAttribute("shape-rendering","crispEdges"));L=P[Y];L.setAttribute("x1",O.positionScreen.x);L.setAttribute("y1",O.positionScreen.y);L.setAttribute("x2",H.positionScreen.x);L.setAttribute("y2",H.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(L))}}}else if(K instanceof
|
|
|
-THREE.RenderableFace3){if(o=K.v1,y=K.v2,x=K.v3,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),A.intersects(z)){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&
|
|
|
+"; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){I[a]==null&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0),
|
|
|
+M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,I=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
|
|
|
+this.render=function(a,e){var f,p,u,B,O,I,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f<p;f++)u=K[f],B=u.color,u instanceof THREE.AmbientLight?(F.r+=B.r,F.g+=B.g,F.b+=B.b):u instanceof THREE.DirectionalLight?(M.r+=B.r,M.g+=B.g,M.b+=B.b):u instanceof THREE.PointLight&&(E.r+=B.r,E.g+=B.g,E.b+=B.b)}f=0;for(p=k.length;f<
|
|
|
+p;f++)if(K=k[f],z.empty(),K instanceof THREE.RenderableParticle){o=K;o.x*=t;o.y*=-v;u=0;for(B=K.materials.length;u<B;)u++}else if(K instanceof THREE.RenderableLine){if(o=K.v1,y=K.v2,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(z)){u=0;for(B=K.materials.length;u<B;)if((R=K.materials[u++])&&R.opacity!=0){O=o;I=y;var Y=S++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),m==0&&P[Y].setAttribute("shape-rendering","crispEdges"));L=P[Y];L.setAttribute("x1",O.positionScreen.x);L.setAttribute("y1",O.positionScreen.y);L.setAttribute("x2",I.positionScreen.x);L.setAttribute("y2",I.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(L))}}}else if(K instanceof
|
|
|
+THREE.RenderableFace3){if(o=K.v1,y=K.v2,x=K.v3,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),A.intersects(z)){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(I=K.faceMaterials.length;O<I;)(R=K.faceMaterials[O++])&&
|
|
|
R.opacity!=0&&b(o,y,x,K,R,a)}else R&&R.opacity!=0&&b(o,y,x,K,R,a)}}else if(K instanceof THREE.RenderableFace4&&(o=K.v1,y=K.v2,x=K.v3,w=K.v4,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),z.addPoint(w.positionScreen.x,w.positionScreen.y),
|
|
|
-A.intersects(z))){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&R.opacity!=0&&c(o,y,x,w,K,R,a)}else R&&R.opacity!=0&&c(o,y,x,w,K,R,a)}}};
|
|
|
+A.intersects(z))){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(I=K.faceMaterials.length;O<I;)(R=K.faceMaterials[O++])&&R.opacity!=0&&c(o,y,x,w,K,R,a)}else R&&R.opacity!=0&&c(o,y,x,w,K,R,a)}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
@@ -233,8 +233,8 @@ l.value[index];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type===
|
|
|
l.value.length;for(n=0;n<p;n++){h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=l.value[n];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}if(v||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),
|
|
|
m.bufferData(m.ARRAY_BUFFER,t,c);if(G||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,o,c);if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,l.buffer),m.bufferData(m.ARRAY_BUFFER,l.array,c)}}function e(a,c,b,e,k){e.program||S.initMaterial(e,c,b,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var f=0,h=S.maxMorphTargets;f<
|
|
|
h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!==U&&(m.useProgram(f),U=f,l=!0);if(e.id!==da)da=e.id,l=!0;if(l){m.uniformMatrix4fv(h.projectionMatrix,!1,Da);if(b&&e.fog)if(n.fogColor.value=b.color,b instanceof THREE.Fog)n.fogNear.value=b.near,n.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)n.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,o=0,u=0,v=0,G,w,x,y=Fa,ma=y.directional.colors,
|
|
|
-$=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,I=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
|
|
|
-THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=I*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[I]=x,I+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=I*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=I;y.directional.length=
|
|
|
+$=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,H=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
|
|
|
+THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=H*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[H]=x,H+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=H*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=H;y.directional.length=
|
|
|
B;y.ambient[0]=o;y.ambient[1]=u;y.ambient[2]=v;c=Fa;n.enableLighting.value=c.directional.length+c.point.length;n.ambientLightColor.value=c.ambient;n.directionalLightColor.value=c.directional.colors;n.directionalLightDirection.value=c.directional.positions;n.pointLightColor.value=c.point.colors;n.pointLightPosition.value=c.point.positions;n.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
|
|
|
e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
|
|
if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=xa.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
|
|
@@ -258,52 +258,52 @@ c,b){X!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),
|
|
|
for(var c,a=0;a<6;a++)c=ua[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ua[e].x*c.n14+ua[e].y*c.n24+ua[e].z*c.n34+ua[e].w,a<=b)return!1;return!0}function v(a){var c=a.object.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function o(a){var c=a.object,b=a.buffer,e;e=c.material;if(e instanceof THREE.MeshFaceMaterial){if(b=
|
|
|
b.materialIndex,b>=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c<b;c++)if(n=x[c],n instanceof THREE.SpotLight&&n.castShadow){da=
|
|
|
-1;S.shadowMap[p]||(S.shadowMap[p]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ka[p]||(ka[p]=new THREE.Matrix4);o=S.shadowMap[p];v=ka[p];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ea);
|
|
|
-pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);S.initWebGLObjects(a);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(I.r,I.g,I.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);
|
|
|
-for(o=0;o<v;o++)if(G=a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));
|
|
|
-p++}}function w(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);
|
|
|
-m.uniformMatrix4fv(k.projectionMatrix,!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&
|
|
|
-(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),
|
|
|
-m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
-a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a){for(var c in a.attributes)if(a.attributes[c].needsUpdate)return!0;return!1}function C(a){for(var c in a.attributes)a.attributes[c].needsUpdate=!1}function B(a,c){for(var b=a.length-1;b>=0;b--)a[b].object===c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);
|
|
|
-m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)===0&&(b.height&b.height-1)===0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,
|
|
|
-m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;
|
|
|
-m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,
|
|
|
-m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
|
|
|
-if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,
|
|
|
-b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!==ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a==="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a==="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),
|
|
|
-null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;
|
|
|
-case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;
|
|
|
-case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,
|
|
|
-Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,
|
|
|
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=
|
|
|
-!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
|
|
|
-" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(I.r,I.g,I.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
-0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=
|
|
|
-m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,
|
|
|
-"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=
|
|
|
-m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=
|
|
|
-c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return N};
|
|
|
-this.clear=function(a,c,b){var e=0;if(a===void 0||a)e|=m.COLOR_BUFFER_BIT;if(c===void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b===void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);
|
|
|
-m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);
|
|
|
-S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=
|
|
|
-function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");
|
|
|
-if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=
|
|
|
-e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
|
|
|
-maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;for(e=aa.length;w<e;w++)if(aa[w].code===l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,
|
|
|
-"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(H.r,H.g,H.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);for(o=0;o<v;o++)if(G=
|
|
|
+a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));p++}}function w(a,
|
|
|
+c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.uniformMatrix4fv(k.projectionMatrix,
|
|
|
+!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,
|
|
|
+1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),
|
|
|
+m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
|
|
|
+function z(a){for(var c in a.attributes)if(a.attributes[c].needsUpdate)return!0;return!1}function C(a){for(var c in a.attributes)a.attributes[c].needsUpdate=!1}function B(a,c){for(var b=a.length-1;b>=0;b--)a[b].object===c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,
|
|
|
+m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)===0&&(b.height&b.height-1)===0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,
|
|
|
+m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
|
|
|
+m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
|
|
|
+m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();
|
|
|
+if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,
|
|
|
+f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),
|
|
|
+O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!==ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function I(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),
|
|
|
+m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a==="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a==="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;
|
|
|
+default:return m.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;
|
|
|
+case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}
|
|
|
+var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,H=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=
|
|
|
+this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
|
|
|
+vertexShader:a.vertexShader,uniforms:ya}),Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,
|
|
|
+0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(H.r,H.g,H.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=
|
|
|
+-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,
|
|
|
+W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=
|
|
|
+m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");
|
|
|
+W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?
|
|
|
+m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){H.setHex(a);N=c;m.clearColor(H.r,H.g,H.b,N)};this.setClearColor=function(a,c){H.copy(a);N=c;m.clearColor(H.r,H.g,H.b,N)};this.getClearColor=function(){return H};this.getClearAlpha=function(){return N};this.clear=function(a,c,b){var e=0;if(a===void 0||a)e|=m.COLOR_BUFFER_BIT;if(c===void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b===void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=
|
|
|
+function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);
|
|
|
+m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof
|
|
|
+THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":
|
|
|
+a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof
|
|
|
+THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,
|
|
|
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;
|
|
|
+for(e=aa.length;w<e;w++)if(aa[w].code===l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":
|
|
|
+"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,b.alphaTest?"#define ALPHATEST "+b.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",b.useFog&&b.fog?"#define USE_FOG":"",b.useFog&&b.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":
|
|
|
"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.metal?"#define METAL":"",b.perPixel?"#define PHONG_PER_PIXEL":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.shadowMapSoft?"#define SHADOWMAP_WIDTH "+b.shadowMapWidth.toFixed(1):"",b.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+b.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(w,P("fragment",h+p));m.attachShader(w,
|
|
|
P("vertex",e+t));m.linkProgram(w);m.getProgramParameter(w,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(w,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");w.uniforms={};w.attributes={};var G,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(G in n)e.push(G);G=e;e=0;for(n=G.length;e<n;e++)p=G[e],w.uniforms[p]=m.getUniformLocation(w,
|
|
|
p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(G=0;G<b.maxMorphTargets;G++)e.push("morphTarget"+G);for(u in c)e.push(u);u=e;G=0;for(c=u.length;G<c;G++)b=u[G],w.attributes[b]=m.getAttribLocation(w,b);w.id=aa.length;aa.push({program:w,code:l});S.info.memory.programs=aa.length;u=w}a.program=u;u=a.program.attributes;u.position>=0&&m.enableVertexAttribArray(u.position);u.color>=0&&m.enableVertexAttribArray(u.color);u.normal>=0&&m.enableVertexAttribArray(u.normal);
|
|
|
u.tangent>=0&&m.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(m.enableVertexAttribArray(u.skinVertexA),m.enableVertexAttribArray(u.skinVertexB),m.enableVertexAttribArray(u.skinIndex),m.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(k in a.attributes)u[k]!==void 0&&u[k]>=0&&m.enableVertexAttribArray(u[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)G="morphTarget"+k,u[G]>=0&&(m.enableVertexAttribArray(u[G]),
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,I,K,E=a.lights,na=a.fog;da=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=z.parent;z.update(void 0,!0)}a.update(void 0,!1,
|
|
|
-c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);this.initWebGLObjects(a);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G<z;G++)if(B=a.__webglObjects[G],I=B.object,I.visible)if(!(I instanceof THREE.Mesh)||!I.frustumCulled||t(I)){if(I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),o(B),B.render=!0,this.sortObjects)B.object.renderDepth?
|
|
|
-B.z=B.object.renderDepth:(za.copy(I.position),sa.multiplyVector3(za),B.z=za.z)}else B.render=!1;else B.render=!1;this.sortObjects&&a.__webglObjects.sort(y);C=a.__webglObjectsImmediate.length;for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),v(B));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render)I=B.object,K=B.buffer,
|
|
|
-k(I),f(c,E,na,a.overrideMaterial,K,I);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,k(I),ma=e(c,E,na,a.overrideMaterial,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),f(c,E,na,$,K,
|
|
|
-I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
|
|
|
-f(c,E,na,$,K,I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&H(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,H,K,E=a.lights,na=a.fog;da=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=
|
|
|
+z.parent;z.update(void 0,!0)}a.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G<z;G++)if(B=a.__webglObjects[G],H=B.object,H.visible)if(!(H instanceof THREE.Mesh)||!H.frustumCulled||t(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),o(B),B.render=
|
|
|
+!0,this.sortObjects)H.renderDepth?B.z=H.renderDepth:(za.copy(H.position),sa.multiplyVector3(za),B.z=za.z)}else B.render=!1;else B.render=!1;this.sortObjects&&a.__webglObjects.sort(y);C=a.__webglObjectsImmediate.length;for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),v(B));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(G=0;G<z;G++)if(B=a.__webglObjects[G],
|
|
|
+B.render)H=B.object,K=B.buffer,k(H),f(c,E,na,a.overrideMaterial,K,H);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(ia=-1,k(H),ma=e(c,E,na,a.overrideMaterial,H),H.immediateRenderCallback?H.immediateRenderCallback(ma,m,ua):H.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(H=B.object,K=B.buffer,$=B.opaque))k(H),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
|
|
|
+f(c,E,na,$,K,H);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(ia=-1,$=B.opaque))k(H),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,H),H.immediateRenderCallback?H.immediateRenderCallback(ma,m,ua):H.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(H=B.object,K=B.buffer,$=B.transparent))k(H),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,
|
|
|
+$.polygonOffsetUnits),f(c,E,na,$,K,H);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(ia=-1,$=B.transparent))k(H),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,H),H.immediateRenderCallback?H.immediateRenderCallback(ma,m,ua):H.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&I(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
|
|
|
[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var l=h,n=void 0,p=void 0,t=void 0,o=void 0,
|
|
|
v=t=void 0,u=void 0,G={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(p=l.faces.length;n<p;n++)t=l.faces[n],o=t.materialIndex,v=o!==void 0?o:-1,G[v]===void 0&&(G[v]={hash:v,counter:0}),u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:w}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+t>65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],
|
|
|
materialIndex:o,vertices:0,numMorphTargets:w})),l.geometryGroups[u].faces.push(n),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ha++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=m.createBuffer();n.__webglNormalBuffer=m.createBuffer();n.__webglTangentBuffer=m.createBuffer();n.__webglColorBuffer=m.createBuffer();n.__webglUVBuffer=
|
|
@@ -318,23 +318,23 @@ l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertice
|
|
|
attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=o,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)l=h.geometryGroups[k],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
|
|
|
e instanceof THREE.ParticleSystem?(h=e.geometry,K(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)B(f.__webglObjects,
|
|
|
e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;for(h=f.length-1;h>=0;h--)f[h]===k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=a.__webglObjects[e].object,k=h.geometry,l=v=o=void 0,h instanceof THREE.Mesh){n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(o=k.geometryGroupsList[n],l=b(h,o),v=l.attributes&&z(l),k.__dirtyVertices||
|
|
|
-k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||v)if(v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,I=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,H=void 0,F=void 0,fa=void 0,ta=void 0,N=I=O=I=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=I=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,
|
|
|
+k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||v)if(v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,H=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,I=void 0,F=void 0,fa=void 0,ta=void 0,N=H=O=H=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=H=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,
|
|
|
aa=o.__tangentArray,da=o.__colorArray,ga=o.__skinVertexAArray,ea=o.__skinVertexBArray,Z=o.__skinIndexArray,ca=o.__skinWeightArray,ja=o.__morphTargetsArrays,oa=o.__webglCustomAttributesList,D=void 0,Ca=o.__faceArray,va=o.__lineArray,Ba=o.__needsSmoothNormals,y=o.__vertexColorType,t=o.__uvType,ma=o.__normalType,sa=h.geometry,Da=sa.__dirtyVertices,Ea=sa.__dirtyElements,za=sa.__dirtyUvs,Fa=sa.__dirtyNormals,xa=sa.__dirtyTangents,Ga=sa.__dirtyColors,Ta=sa.__dirtyMorphTargets,Pa=sa.vertices,bb=o.faces,
|
|
|
-eb=sa.faces,cb=sa.faceVertexUvs[0],db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],I=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=I.vertexNormals,A=I.normal,E=I.vertexColors,na=I.color,O=I.vertexTangents,I instanceof THREE.Face3){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+
|
|
|
-3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,P+=9;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.offsetSrc+=
|
|
|
-3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=D.value[I.c]):D.boundTo==="faces"?(fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=
|
|
|
-F.b,D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,
|
|
|
-F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,
|
|
|
-Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length===3&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2]):L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,
|
|
|
-da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,T+=12;if(Fa&&ma)if($.length===3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&
|
|
|
-t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(I instanceof THREE.Face4){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ta=Pa[I.d].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=
|
|
|
-D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c],D.array[J+3]=D.value[I.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],
|
|
|
-F=D.value[I.b],fa=D.value[I.c],ta=D.value[I.d]):D.boundTo==="faces"?(ta=fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,
|
|
|
-D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=
|
|
|
-fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,ta=Ia[N].vertices[I.d].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],D=Ja[I.d],ca[Q]=
|
|
|
-N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],D=Sa[I.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],D=Qa[I.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=
|
|
|
-L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],I=Ra[I.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=I.x,ea[Q+13]=I.y,ea[Q+14]=I.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length===4&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,
|
|
|
-da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length===4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,
|
|
|
+eb=sa.faces,cb=sa.faceVertexUvs[0],db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],H=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=H.vertexNormals,A=H.normal,E=H.vertexColors,na=H.color,O=H.vertexTangents,H instanceof THREE.Face3){if(Da)I=Pa[H.a].position,F=Pa[H.b].position,fa=Pa[H.c].position,ka[P]=I.x,ka[P+1]=I.y,ka[P+2]=I.z,ka[P+
|
|
|
+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,P+=9;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[H.a],D.array[J+1]=D.value[H.b],D.array[J+2]=D.value[H.c]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.offsetSrc+=
|
|
|
+3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(I=D.value[H.a],F=D.value[H.b],fa=D.value[H.c]):D.boundTo==="faces"?(fa=F=I=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(I=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=I.r,D.array[J+1]=I.g,D.array[J+2]=I.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=
|
|
|
+F.b,D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=I.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)I=Ia[N].vertices[H.a].position,
|
|
|
+F=Ia[N].vertices[H.b].position,fa=Ia[N].vertices[H.c].position,J=ja[N],J[U]=I.x,J[U+1]=I.y,J[U+2]=I.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[H.a],L=Ja[H.b],J=Ja[H.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[H.a],L=Sa[H.b],J=Sa[H.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,
|
|
|
+Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[H.a],L=Qa[H.b],J=Qa[H.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[H.a],L=Ra[H.b],J=Ra[H.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length===3&&y===THREE.VertexColors?(H=E[0],N=E[1],L=E[2]):L=N=H=na,da[V]=H.r,da[V+1]=H.g,da[V+2]=H.b,da[V+3]=N.r,da[V+4]=N.g,
|
|
|
+da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],H=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=H.x,aa[T+9]=H.y,aa[T+10]=H.z,aa[T+11]=H.w,T+=12;if(Fa&&ma)if($.length===3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&
|
|
|
+t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(H instanceof THREE.Face4){if(Da)I=Pa[H.a].position,F=Pa[H.b].position,fa=Pa[H.c].position,ta=Pa[H.d].position,ka[P]=I.x,ka[P+1]=I.y,ka[P+2]=I.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=
|
|
|
+D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[H.a],D.array[J+1]=D.value[H.b],D.array[J+2]=D.value[H.c],D.array[J+3]=D.value[H.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(I=D.value[H.a],
|
|
|
+F=D.value[H.b],fa=D.value[H.c],ta=D.value[H.d]):D.boundTo==="faces"?(ta=fa=F=I=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(I=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=I.r,D.array[J+1]=I.g,D.array[J+2]=I.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,
|
|
|
+D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=I.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=
|
|
|
+fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)I=Ia[N].vertices[H.a].position,F=Ia[N].vertices[H.b].position,fa=Ia[N].vertices[H.c].position,ta=Ia[N].vertices[H.d].position,J=ja[N],J[U]=I.x,J[U+1]=I.y,J[U+2]=I.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[H.a],L=Ja[H.b],J=Ja[H.c],D=Ja[H.d],ca[Q]=
|
|
|
+N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[H.a],L=Sa[H.b],J=Sa[H.c],D=Sa[H.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[H.a],L=Qa[H.b],J=Qa[H.c],D=Qa[H.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=
|
|
|
+L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[H.a],L=Ra[H.b],J=Ra[H.c],H=Ra[H.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=H.x,ea[Q+13]=H.y,ea[Q+14]=H.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length===4&&y===THREE.VertexColors?(H=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=H=na,da[V]=H.r,da[V+1]=H.g,da[V+2]=H.b,da[V+3]=N.r,
|
|
|
+da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],H=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=H.x,aa[T+9]=H.y,aa[T+10]=H.z,aa[T+11]=H.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length===4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,
|
|
|
ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<4;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<4;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+3,Ca[la+3]=R+1,Ca[la+4]=R+2,Ca[la+5]=R+3,la+=6,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+3,va[W+4]=R+1,va[W+5]=R+2,va[W+6]=R+2,va[W+7]=R+3,W+=8,R+=4)}Da&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,ka,v));if(oa){N=0;for(L=oa.length;N<L;N++)D=oa[N],D.__original.needsUpdate&&
|
|
|
(m.bindBuffer(m.ARRAY_BUFFER,D.buffer),m.bufferData(m.ARRAY_BUFFER,D.array,v))}if(Ta){N=0;for(L=Ia.length;N<L;N++)m.bindBuffer(m.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[N]),m.bufferData(m.ARRAY_BUFFER,ja[N],v)}Ga&&V>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,v));Fa&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,ya,v));xa&&sa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,
|
|
|
v));za&&qa>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ia,v));za&&Y>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ua,v));Ea&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ca,v),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,va,v));Q>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,ga,v),m.bindBuffer(m.ARRAY_BUFFER,
|
|
@@ -495,13 +495,13 @@ this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[t].positio
|
|
|
B=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
|
|
|
-l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length-
|
|
|
+l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(I=a.length;--I>=0;){ja=I;ca=I-1;ca<0&&(ca=a.length-
|
|
|
1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=aa*c,k=aa*(c+1),h=Z+ja+e,f=Z+ja+k,m=h,e=Z+ca+e,k=Z+ca+k,p=f;m+=V;e+=V;k+=V;p+=V;O.faces.push(new THREE.Face4(m,e,k,p,null,null,B));B&&(m=c/b,e=(c+1)/b,k=l+n*2,h=(O.vertices[h].position.z+n)/k,f=(O.vertices[f].position.z+n)/k,O.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=V;c+=V;b+=V;O.faces.push(new THREE.Face3(a,
|
|
|
c,b,null,null,C));if(C){var e=K.maxY,k=K.maxX,h=O.vertices[c].position.x,c=O.vertices[c].position.y,f=O.vertices[b].position.x,b=O.vertices[b].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/k,O.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,n=b.bevelThickness!==void 0?b.bevelThickness:6,p=b.bevelSize!==void 0?b.bevelSize:n-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,t=b.bevelEnabled!==void 0?b.bevelEnabled:
|
|
|
!0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,y=b.bendPath,x=b.extrudePath,w,A=!1,z=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,C=b.material,B=b.extrudeMaterial,K=this.shapebb;if(x)w=x.getPoints(v),o=w.length,A=!0,t=!1;t||(p=n=u=0);var F,M,E,O=this,V=this.vertices.length;y&&a.addWrapPath(y);v=z?a.extractAllSpacedPoints(v):a.extractAllPoints(v);y=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();M=0;for(E=v.length;M<E;M++)F=v[M],THREE.Shape.Utils.isClockWise(F)&&
|
|
|
-(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var H,P,L,T,S,m,aa=y.length,U=x.length,ea=[];H=0;P=z.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ea[H]=e(z[H],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];H=0;P=F.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ia[H]=e(F[H],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*
|
|
|
-(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),h(m.x,m.y,-S)}}T=p;for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,
|
|
|
-m.y,l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(H=0;H<U;H++)p=x[H],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(H=0;H<U;H++)p=x[H],k(p[0]+t,p[1]+t,p[2]+t)}else{for(H=0;H<U;H++)p=x[H],k(p[2],p[1],p[0]);for(H=0;H<U;H++)p=x[H],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var I,P,L,T,S,m,aa=y.length,U=x.length,ea=[];I=0;P=z.length;ja=P-1;for(ca=I+1;I<P;I++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ea[I]=e(z[I],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];I=0;P=F.length;ja=P-1;for(ca=I+1;I<P;I++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ia[I]=e(F[I],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*
|
|
|
+(1-T);T=p*Math.sin(T*Math.PI/2);I=0;for(P=z.length;I<P;I++)m=c(z[I],ea[I],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];I=0;for(P=F.length;I<P;I++)m=c(F[I],ia[I],T),h(m.x,m.y,-S)}}T=p;for(I=0;I<aa;I++)m=t?c(y[I],ha[I],T):y[I],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(I=0;I<aa;I++)m=t?c(y[I],ha[I],T):y[I],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);I=0;for(P=z.length;I<P;I++)m=c(z[I],ea[I],T),h(m.x,
|
|
|
+m.y,l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];I=0;for(P=F.length;I<P;I++)m=c(F[I],ia[I],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(I=0;I<U;I++)p=x[I],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(I=0;I<U;I++)p=x[I],k(p[0]+t,p[1]+t,p[2]+t)}else{for(I=0;I<U;I++)p=x[I],k(p[2],p[1],p[0]);for(I=0;I<U;I++)p=x[I],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};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.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
|
|
|
-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),p=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,n,u,a);c(h.faces[l].b,p,
|
|
@@ -525,7 +525,7 @@ this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,k=[
|
|
|
p));f.moveTo(l,p);break;case "l":l=b[a++]*c+e;p=b[a++]*c;h.push(new THREE.Vector2(l,p));f.lineTo(l,p);break;case "q":l=b[a++]*c+e;p=b[a++]*c;v=b[a++]*c+e;o=b[a++]*c;f.quadraticCurveTo(v,o,l,p);if(k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var A=k/divisions,z=THREE.Shape.Utils.b2(A,u,v,l),A=THREE.Shape.Utils.b2(A,t,o,p);h.push(new THREE.Vector2(z,A))}}break;case "b":if(l=b[a++]*c+e,p=b[a++]*c,v=b[a++]*c+e,o=b[a++]*-c,y=b[a++]*c+e,x=b[a++]*-c,f.bezierCurveTo(l,p,
|
|
|
v,o,y,x),k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)A=k/divisions,z=THREE.Shape.Utils.b3(A,u,v,y,l),A=THREE.Shape.Utils.b3(A,t,o,x,p),h.push(new THREE.Vector2(z,A))}}}return{offset:w.ha*c,points:h,path:f}}}};
|
|
|
(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,k=0;k<b;h=k++)f+=a[h].x*a[k].y-a[k].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],k=[],l=[],n,p,u;if(b(a)>0)for(p=0;p<f;p++)k[p]=p;else for(p=0;p<f;p++)k[p]=f-1-p;var t=2*f;for(p=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=p;f<=n&&(n=0);p=n+1;f<=p&&(p=0);u=p+1;f<=u&&(u=0);var v;a:{v=a;var o=n,y=p,x=u,w=f,A=k,z=void 0,C=void 0,B=void 0,
|
|
|
-K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z<w;z++)if(!(z==o||z==y||z==x)){var O=v[A[z]].x,V=v[A[z]].y,H=void 0,P=void 0,L=void 0,T=void 0,S=void 0,m=void 0,aa=void 0,U=void 0,ea=void 0,da=void 0,ia=void 0,ha=void 0,H=L=S=void 0,H=M-K,P=E-F,L=C-M,T=B-E,S=K-C,m=F-B,aa=O-C,U=V-B,ea=O-K,da=V-F,ia=O-M,ha=V-E,H=H*da-P*ea,S=S*U-m*aa,L=L*ha-T*ia;if(H>=0&&L>=0&&S>=0){v=!1;
|
|
|
+K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z<w;z++)if(!(z==o||z==y||z==x)){var O=v[A[z]].x,V=v[A[z]].y,I=void 0,P=void 0,L=void 0,T=void 0,S=void 0,m=void 0,aa=void 0,U=void 0,ea=void 0,da=void 0,ia=void 0,ha=void 0,I=L=S=void 0,I=M-K,P=E-F,L=C-M,T=B-E,S=K-C,m=F-B,aa=O-C,U=V-B,ea=O-K,da=V-F,ia=O-M,ha=V-E,I=I*da-P*ea,S=S*U-m*aa,L=L*ha-T*ia;if(I>=0&&L>=0&&S>=0){v=!1;
|
|
|
break a}}v=!0}}if(v){h.push([a[k[n]],a[k[p]],a[k[u]]]);l.push([k[n],k[p],k[u]]);n=p;for(u=p+1;u<f;n++,u++)k[n]=k[u];f--;t=2*f}}if(e)return l;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,b,c,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);l.z=
|
|
|
this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(l.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e,l=(this.segmentsT+1)*c+e,n=new THREE.Face4(f,h,k,l,[b[f],b[h],b[k],b[l]]);n.normal.addSelf(b[f]);n.normal.addSelf(b[h]);n.normal.addSelf(b[k]);n.normal.addSelf(b[l]);n.normal.normalize();this.faces.push(n);
|
|
@@ -555,11 +555,11 @@ b,e,c,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var k=new XMLHttpRequest,l=e+"/"+a,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,f,b):alert("Couldn't load ["+l+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",l,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
k.setRequestHeader("Content-Type","text/plain");k.send(null)};
|
|
|
THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(c){function b(a,c){var e=u(a,c),f=u(a,c+1),h=u(a,c+2),k=u(a,c+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function n(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function p(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function t(c){var b,
|
|
|
-e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+H);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b,
|
|
|
-e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],I=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,I,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b*
|
|
|
+e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+I);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b,
|
|
|
+e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],H=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,H,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b*
|
|
|
2+1];b=K[e*2];var m=A.faceVertexUvs[0];e=K[e*2+1];var n=K[h*2];h=K[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ha);h=f(a,c+ja);k=f(a,c+ca);c=K[b*2];m=K[b*2+1];b=K[e*2];n=K[e*2+1];e=K[h*2];var o=A.faceVertexUvs[0];h=K[h*2+1];var p=K[k*2];k=K[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var A=this,z=0,C,B=[],K=
|
|
|
-[],F,M,E,O,V,H,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,
|
|
|
-z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes*
|
|
|
+[],F,M,E,O,V,I,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,
|
|
|
+z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;I=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes*
|
|
|
4;m=C.vertex_index_bytes*4+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;da=C.uv_index_bytes;ia=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ca=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes;Z=C.ntri_flat*c;R=C.ntri_smooth*(c+
|
|
|
C.normal_index_bytes*3);Y=C.ntri_flat_uv*(c+C.uv_index_bytes*3);X=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ga=C.nquad_flat*oa;c=C.nquad_smooth*(oa+C.normal_index_bytes*4);oa=C.nquad_flat_uv*(oa+C.uv_index_bytes*4);z+=function(c){for(var e,h,f,l=C.vertex_coordinate_bytes*3,m=c+C.nvertices*l;c<m;c+=l)e=b(a,c),h=b(a,c+C.vertex_coordinate_bytes),f=b(a,c+C.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,f)));return C.nvertices*l}(z);z+=function(c){for(var b,
|
|
|
e,h,f=C.normal_coordinate_bytes*3,k=c+C.nnormals*f;c<k;c+=f)b=p(a,c),e=p(a,c+C.normal_coordinate_bytes),h=p(a,c+C.normal_coordinate_bytes*2),B.push(b/127,e/127,h/127);return C.nnormals*f}(z);z+=function(c){for(var e,h,f=C.uv_coordinate_bytes*2,l=c+C.nuvs*f;c<l;c+=f)e=b(a,c),h=b(a,c+C.uv_coordinate_bytes),K.push(e,h);return C.nuvs*f}(z);Z=z+Z;R=Z+R;Y=R+Y;X=Y+X;ga=X+ga;c=ga+c;oa=c+oa;(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes,e=b+C.uv_index_bytes*3,h=a+C.ntri_flat_uv*e;for(c=
|
|
@@ -579,7 +579,7 @@ qa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");else
|
|
|
0;k<a.nodes.length;k++)c.add(h(a.nodes[k],a));return c}function k(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function t(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=
|
|
|
[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function v(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function w(){this.id="";this.mesh=null}function A(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function C(){this.material="";this.count=0;this.inputs=
|
|
|
[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function B(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function F(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function O(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function V(a,c){this.type=
|
|
|
-a;this.effect=c;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function T(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function m(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
+a;this.effect=c;this.material=null}function I(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function T(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function m(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
this.sid=null}function aa(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function U(a){var c=a.getAttribute("id");if(oa[c]!=void 0)return oa[c];oa[c]=(new M(c)).parse(a);return oa[c]}function ea(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function da(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function ia(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],
|
|
|
10));return c}function ha(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ja(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function ca(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function Z(a,c){var b="";b+=ca(a.x,c)+",";b+=ca(a.y,c)+",";b+=ca(a.z,c);return b}var R=null,Y=null,X,ga=null,oa={},na={},fa={},qa={},la={},ua=
|
|
|
{},sa={},Da,Ea,za,Fa,xa=THREE.SmoothShading;k.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new p).parse(b);this.type=b.nodeName;break;case "morph":this.morph=
|
|
@@ -611,10 +611,10 @@ switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.dat
|
|
|
"instance_effect"){this.instance_effect=(new T).parse(a.childNodes[c]);break}return this};O.prototype.isColor=function(){return this.texture==null};O.prototype.isTexture=function(){return this.texture!=null};O.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=da(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),
|
|
|
this.texcoord=b.getAttribute("texcoord")}}return this};V.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new O).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=R.evaluate(".//dae:float",b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=e.iterateNext(),f=[];h;)f.push(h),h=e.iterateNext();
|
|
|
e=f;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};V.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof O)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from),
|
|
|
-a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=
|
|
|
+a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=
|
|
|
b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};P.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;
|
|
|
break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};L.prototype.create=function(){if(this.shader==null)return null};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};L.prototype.parseNewparam=
|
|
|
-function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new H(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new P(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
+function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new I(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new P(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};L.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new V(b.nodeName,this)).parse(b)}}};T.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=(new M).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new aa(this)).parse(b));break;case "channel":this.channel.push((new m(this)).parse(b))}}return this};m.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=
|
|
|
c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};aa.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new F).parse(b))}}return this};
|
|
@@ -632,9 +632,9 @@ THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.pos
|
|
|
s=z.scale;q=0;V.length==0&&(V=new THREE.MeshFaceMaterial);V.length>1&&(V=new THREE.MeshFaceMaterial);object=new THREE.Mesh(F,V);object.name=o;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=z.visible;U.scene.add(object);U.objects[o]=object;z.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(z.castsShadow)a=
|
|
|
new THREE.ShadowVolume(F),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}}else C=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
z.visible!==void 0?z.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}function n(a){return function(b){U.geometries[a]=b;l();T-=1;c.onLoadComplete();u()}}function p(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:m,totalTextures:aa,loadedModels:m-T,loadedTextures:aa-S},U);c.onLoadProgress();T==0&&S==0&&b(U)}var t,v,o,y,x,w,A,z,C,B,K,F,M,E,
|
|
|
-O,V,H,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&&
|
|
|
+O,V,I,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&&
|
|
|
U.scene.scale.set(ea[0],ea[1],ea[2]);(a||B||ea)&&U.scene.updateMatrix()}a=function(){S-=1;u();c.onLoadComplete()};for(x in P.cameras)B=P.cameras[x],B.type=="perspective"?M=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type=="ortho"&&(M=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),C=B.position,B=B.target,M.position.set(C[0],C[1],C[2]),M.target=new THREE.Vector3(B[0],B[1],B[2]),U.cameras[x]=M;for(y in P.lights)x=P.lights[y],M=x.color!==void 0?x.color:16777215,
|
|
|
-B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,H=new THREE.DirectionalLight(M,B),H.position.set(C[0],C[1],C[2]),H.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,H=new THREE.PointLight(M,B,d),H.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(M)),U.scene.add(H),U.lights[y]=H;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0],
|
|
|
+B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,I=new THREE.DirectionalLight(M,B),I.position.set(C[0],C[1],C[2]),I.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,I=new THREE.PointLight(M,B,d),I.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(I=new THREE.AmbientLight(M)),U.scene.add(I),U.lights[y]=I;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0],
|
|
|
B[1],B[2]),U.fogs[w]=E;if(U.cameras&&P.defaults.camera)U.currentCamera=U.cameras[P.defaults.camera];if(U.fogs&&P.defaults.fog)U.scene.fog=U.fogs[P.defaults.fog];B=P.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(B[0],B[1],B[2]);U.bgColorAlpha=P.defaults.bgalpha;for(t in P.geometries)if(w=P.geometries[t],w.type=="bin_mesh"||w.type=="ascii_mesh")T+=1,c.onLoadStart();m=T;for(t in P.geometries)w=P.geometries[t],w.type=="cube"?(F=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth,
|
|
|
w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),U.geometries[t]=F):w.type=="plane"?(F=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="sphere"?(F=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="cylinder"?(F=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[t]=F):w.type=="torus"?(F=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[t]=
|
|
|
F):w.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[t]=F):w.type=="bin_mesh"?O.load(e(w.url,P.urlBaseType),n(t)):w.type=="ascii_mesh"?L.load(e(w.url,P.urlBaseType),n(t)):w.type=="embedded_mesh"&&(w=P.embeds[w.id])&&L.createModel(w,p(t),"");for(A in P.textures)if(t=P.textures[A],t.url instanceof Array){S+=t.url.length;for(O=0;O<t.url.length;O++)c.onLoadStart()}else S+=1,c.onLoadStart();aa=S;for(A in P.textures){t=P.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=
|
|
@@ -647,7 +647,7 @@ THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var e=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,h=c.offsetX!==void 0?c.offsetX:0,k=c.offsetY!==void 0?c.offsetY:0,l=c.offsetZ!==void 0?c.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
|
b,f,h,k,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,k=0;k<b;++k){var l=a.charCodeAt(k+e);h+=l>>1^-(l&1);c[8*k+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=k=0;f<b;f++)l=a.charCodeAt(f+e),h[f]=k-l,l==0&&k++;return[c,h]};
|
|
|
THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var k=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],u=[];(function(a,k,n){for(var p,u,w,A=a.length;n<A;n+=k)p=a[n],u=a[n+1],w=a[n+2],p=p/16383*c,u=u/16383*c,w=w/16383*c,p+=e,u+=f,w+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(p,u,w)))})(k[0],8,0);(function(a,c,b){for(var e,f,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,u.push(e,1-f)})(k[0],8,3);(function(a,
|
|
|
-c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,n,z,C,B,K=a.length;for(c=0;c<K;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;C=e;B=f;n=h;z=e;var F=f,M=h,E=k.materials[0],O=p[F*3],V=p[F*3+1],F=p[F*3+2],H=p[M*3],P=p[M*3+1],M=p[M*3+2];z=new THREE.Vector3(p[z*3],p[z*3+1],p[z*3+2]);F=new THREE.Vector3(O,V,F);M=new THREE.Vector3(H,P,M);k.faces.push(new THREE.Face3(C,B,n,[z,F,M],null,E));k=u[e*2];e=u[e*2+
|
|
|
+c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,n,z,C,B,K=a.length;for(c=0;c<K;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;C=e;B=f;n=h;z=e;var F=f,M=h,E=k.materials[0],O=p[F*3],V=p[F*3+1],F=p[F*3+2],I=p[M*3],P=p[M*3+1],M=p[M*3+2];z=new THREE.Vector3(p[z*3],p[z*3+1],p[z*3+2]);F=new THREE.Vector3(O,V,F);M=new THREE.Vector3(I,P,M);k.faces.push(new THREE.Face3(C,B,n,[z,F,M],null,E));k=u[e*2];e=u[e*2+
|
|
|
1];n=u[f*2];z=u[f*2+1];C=u[h*2];B=u[h*2+1];h=b.faceVertexUvs[0];f=n;n=z;z=[];z.push(new THREE.UV(k,e));z.push(new THREE.UV(f,n));z.push(new THREE.UV(C,B));h.push(z)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;b(new k)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
@@ -655,9 +655,9 @@ THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b ins
|
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=n;b[h+2]=p;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n+k*this.delta;b[h+
|
|
|
2]=p;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n;b[h+2]=p+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-
|
|
|
this.field[a+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,k,l){var n=h+1,p=h+this.yd,u=h+this.zd,t=n+this.yd,v=n+this.zd,o=h+this.yd+this.zd,y=n+this.yd+this.zd,x=0,w=this.field[h],A=this.field[n],z=this.field[p],C=this.field[t],B=this.field[u],K=this.field[v],F=this.field[o],M=this.field[y];w<k&&(x|=1);A<k&&(x|=2);z<k&&(x|=8);C<k&&(x|=4);B<k&&(x|=16);K<k&&(x|=32);F<k&&(x|=128);M<k&&(x|=64);var E=THREE.edgeTable[x];if(E===0)return 0;
|
|
|
-var O=this.delta,V=a+O,H=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,H,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));
|
|
|
-E&32&&(this.compNorm(v),this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),
|
|
|
-this.compNorm(y),this.VIntZ(t*3,this.vlist,this.nlist,30,k,V,H,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,H,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+
|
|
|
+var O=this.delta,V=a+O,I=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,I,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));
|
|
|
+E&32&&(this.compNorm(v),this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,I,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),
|
|
|
+this.compNorm(y),this.VIntZ(t*3,this.vlist,this.nlist,30,k,V,I,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,I,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+
|
|
|
3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[k];this.positionArray[n+7]=a[k+1];this.positionArray[n+8]=a[k+2];this.normalArray[n]=b[f];this.normalArray[n+1]=b[f+1];this.normalArray[n+2]=b[f+2];this.normalArray[n+3]=b[h];this.normalArray[n+4]=b[h+1];this.normalArray[n+5]=b[h+2];this.normalArray[n+6]=b[k];this.normalArray[n+7]=b[k+1];this.normalArray[n+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(this)};this.begin=
|
|
|
function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,k){var l=this.size*Math.sqrt(h/k),n=f*this.size,p=b*this.size,u=a*this.size,t=Math.floor(n-l);t<1&&(t=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);
|
|
|
l>this.size-1&&(l=this.size-1);for(var y,x,w,A,z,C;t<n;t++){u=this.size2*t;x=t/this.size-f;z=x*x;for(x=v;x<p;x++){w=u+this.size*x;y=x/this.size-b;C=y*y;for(y=o;y<l;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+z)-k,A>0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f<o;f++)if(h=f/p,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<p;h++){n=f+h*u;for(k=0;k<p;k++)v[t*k+n]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,
|