|
@@ -27,8 +27,8 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,
|
|
|
c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
|
|
|
b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
|
|
|
e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,F=b.n44,E=c.n11,D=c.n12,
|
|
|
-G=c.n13,N=c.n14,O=c.n21,K=c.n22,H=c.n23,B=c.n24,da=c.n31,J=c.n32,R=c.n33,S=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*O+h*da+k*Y;this.n12=e*D+f*K+h*J+k*W;this.n13=e*G+f*H+h*R+k*o;this.n14=e*N+f*B+h*S+k*ea;this.n21=m*E+n*O+t*da+v*Y;this.n22=m*D+n*K+t*J+v*W;this.n23=m*G+n*H+t*R+v*o;this.n24=m*N+n*B+t*S+v*ea;this.n31=w*E+u*O+x*da+p*Y;this.n32=w*D+u*K+x*J+p*W;this.n33=w*G+u*H+x*R+p*o;this.n34=w*N+u*B+x*S+p*ea;this.n41=y*E+A*O+z*da+F*Y;this.n42=y*D+A*K+z*J+F*W;this.n43=y*G+A*H+z*R+F*o;this.n44=
|
|
|
-y*N+A*B+z*S+F*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
|
|
|
+G=c.n13,N=c.n14,O=c.n21,K=c.n22,H=c.n23,B=c.n24,ca=c.n31,J=c.n32,Q=c.n33,R=c.n34,U=c.n41,X=c.n42,o=c.n43,da=c.n44;this.n11=e*E+f*O+h*ca+k*U;this.n12=e*D+f*K+h*J+k*X;this.n13=e*G+f*H+h*Q+k*o;this.n14=e*N+f*B+h*R+k*da;this.n21=m*E+n*O+t*ca+v*U;this.n22=m*D+n*K+t*J+v*X;this.n23=m*G+n*H+t*Q+v*o;this.n24=m*N+n*B+t*R+v*da;this.n31=w*E+u*O+x*ca+p*U;this.n32=w*D+u*K+x*J+p*X;this.n33=w*G+u*H+x*Q+p*o;this.n34=w*N+u*B+x*R+p*da;this.n41=y*E+A*O+z*ca+F*U;this.n42=y*D+A*K+z*J+F*X;this.n43=y*G+A*H+z*Q+F*o;this.n44=
|
|
|
+y*N+A*B+z*R+F*da;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
|
|
|
b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,t=this.n31,v=this.n32,w=this.n33,u=this.n34,x=this.n41,p=this.n42,y=this.n43,A=this.n44;return f*m*v*x-e*n*v*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*u*p+b*m*u*p+f*k*t*y-c*n*t*y-f*h*v*y+b*n*v*y+c*h*u*y-b*k*u*y-e*k*t*A+c*m*t*A+e*h*v*A-b*m*v*A-c*h*
|
|
|
w*A+b*k*w*A},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
|
|
|
this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
|
|
@@ -55,16 +55,16 @@ b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:fu
|
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
|
|
|
this.remove(b)}};THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,t=[],v,w,u=[],x,p=[],y,A,z=[],F,E,D=[],G=[],N=[],O=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
-H=new THREE.Matrix4,B=new THREE.Matrix4,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
|
|
|
-0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var u;if(!(u=!n.visible))if(u=n instanceof THREE.Mesh)if(u=n.frustumCulled){a:{u=void 0;for(var v=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),t=0;t<6;t++)if(u=da[t].x*v.n14+da[t].y*v.n24+da[t].z*v.n34+da[t].w,u<=p){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,O.copy(n.position),H.multiplyVector3(O),f.object=n,f.z=O.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
|
|
|
-function(f,k,h){var o=k.near,G=k.far,O,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,P,oa,qa;E=A=x=w=N.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);H.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);da[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);da[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);da[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);da[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-
|
|
|
-H.n34);da[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(O=0;O<6;O++)$=da[O],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(O=$.length;f<O;f++)if(X=$[f].object,X.visible)if(ga=X.matrixWorld,la=X.matrixRotationWorld,ra=X.materials,na=X.overdraw,n=0,X instanceof THREE.Mesh){P=X.geometry;ia=P.vertices;oa=P.faces;P=P.faceVertexUvs;ma=0;for(Z=ia.length;ma<Z;ma++)m=b(),m.positionWorld.copy(ia[ma].position),ga.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
|
|
|
-H.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;ia=0;for(ma=oa.length;ia<ma;ia++){Z=oa[ia];if(Z instanceof THREE.Face3)if(aa=t[Z.a],ka=t[Z.b],fa=t[Z.c],aa.visible&&ka.visible&&fa.visible&&(X.doubleSided||X.flipSided!=(fa.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<
|
|
|
-0))ca=u[w]=u[w]||new THREE.RenderableFace3,w++,v=ca,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=t[Z.a],ka=t[Z.b],fa=t[Z.c],ca=t[Z.d],aa.visible&&ka.visible&&fa.visible&&ca.visible&&(X.doubleSided||X.flipSided!=((ca.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(ca.positionScreen.y-fa.positionScreen.y)-
|
|
|
-(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=p[x]=p[x]||new THREE.RenderableFace4,x++,v=qa,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa),v.v4.copy(ca);else continue;v.normalWorld.copy(Z.normal);la.multiplyVector3(v.normalWorld);v.centroidWorld.copy(Z.centroid);ga.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);H.multiplyVector3(v.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=v.vertexNormalsWorld[aa],ca.copy(fa[aa]),
|
|
|
-la.multiplyVector3(ca);aa=0;for(ka=P.length;aa<ka;aa++)if(qa=P[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)v.uvs[aa][fa]=qa[fa]}v.meshMaterials=ra;v.faceMaterials=Z.materials;v.overdraw=na;v.z=v.centroidScreen.z;N.push(v)}}else if(X instanceof THREE.Line){B.multiply(H,ga);ia=X.geometry.vertices;aa=b();aa.positionScreen.copy(ia[0].position);B.multiplyVector4(aa.positionScreen);ma=1;for(Z=ia.length;ma<Z;ma++)if(aa=b(),aa.positionScreen.copy(ia[ma].position),B.multiplyVector4(aa.positionScreen),ka=t[n-
|
|
|
-2],J.copy(aa.positionScreen),R.copy(ka.positionScreen),e(J,R))J.multiplyScalar(1/J.w),R.multiplyScalar(1/R.w),ga=z[A]=z[A]||new THREE.RenderableLine,A++,y=ga,y.v1.positionScreen.copy(J),y.v2.positionScreen.copy(R),y.z=Math.max(J.z,R.z),y.materials=X.materials,N.push(y)}else if(X instanceof THREE.Particle&&(K.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=D[E]=D[E]||new THREE.RenderableParticle,E++,F=ga,F.x=K.x/K.w,F.y=K.y/K.w,F.z=K.z,F.rotation=
|
|
|
-X.rotation.z,F.scale.x=X.scale.x*Math.abs(F.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),F.scale.y=X.scale.y*Math.abs(F.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),F.materials=X.materials,N.push(F);h&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
+H=new THREE.Matrix4,B=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
|
|
|
+0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var u;if(!(u=!n.visible))if(u=n instanceof THREE.Mesh)if(u=n.frustumCulled){a:{u=void 0;for(var v=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),t=0;t<6;t++)if(u=ca[t].x*v.n14+ca[t].y*v.n24+ca[t].z*v.n34+ca[t].w,u<=p){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,O.copy(n.position),H.multiplyVector3(O),f.object=n,f.z=O.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
|
|
|
+function(f,k,h){var o=k.near,G=k.far,O,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra,na,P,oa,qa;E=A=x=w=N.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);H.multiply(k.projectionMatrix,k.matrixWorldInverse);ca[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);ca[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);ca[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);ca[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);ca[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-
|
|
|
+H.n34);ca[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(O=0;O<6;O++)$=ca[O],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(O=$.length;f<O;f++)if(Y=$[f].object,Y.visible)if(fa=Y.matrixWorld,ia=Y.matrixRotationWorld,ra=Y.materials,na=Y.overdraw,n=0,Y instanceof THREE.Mesh){P=Y.geometry;ka=P.vertices;oa=P.faces;P=P.faceVertexUvs;la=0;for(ha=ka.length;la<ha;la++)m=b(),m.positionWorld.copy(ka[la].position),fa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
|
|
|
+H.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;ka=0;for(la=oa.length;ka<la;ka++){ha=oa[ka];if(ha instanceof THREE.Face3)if(aa=t[ha.a],ma=t[ha.b],ea=t[ha.c],aa.visible&&ma.visible&&ea.visible&&(Y.doubleSided||Y.flipSided!=(ea.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<
|
|
|
+0))Z=u[w]=u[w]||new THREE.RenderableFace3,w++,v=Z,v.v1.copy(aa),v.v2.copy(ma),v.v3.copy(ea);else continue;else if(ha instanceof THREE.Face4)if(aa=t[ha.a],ma=t[ha.b],ea=t[ha.c],Z=t[ha.d],aa.visible&&ma.visible&&ea.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(Z.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<0||(ma.positionScreen.x-ea.positionScreen.x)*(Z.positionScreen.y-ea.positionScreen.y)-
|
|
|
+(ma.positionScreen.y-ea.positionScreen.y)*(Z.positionScreen.x-ea.positionScreen.x)<0)))qa=p[x]=p[x]||new THREE.RenderableFace4,x++,v=qa,v.v1.copy(aa),v.v2.copy(ma),v.v3.copy(ea),v.v4.copy(Z);else continue;v.normalWorld.copy(ha.normal);ia.multiplyVector3(v.normalWorld);v.centroidWorld.copy(ha.centroid);fa.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);H.multiplyVector3(v.centroidScreen);ea=ha.vertexNormals;aa=0;for(ma=ea.length;aa<ma;aa++)Z=v.vertexNormalsWorld[aa],Z.copy(ea[aa]),
|
|
|
+ia.multiplyVector3(Z);aa=0;for(ma=P.length;aa<ma;aa++)if(qa=P[aa][ka]){ea=0;for(Z=qa.length;ea<Z;ea++)v.uvs[aa][ea]=qa[ea]}v.meshMaterials=ra;v.faceMaterials=ha.materials;v.overdraw=na;v.z=v.centroidScreen.z;N.push(v)}}else if(Y instanceof THREE.Line){B.multiply(H,fa);ka=Y.geometry.vertices;aa=b();aa.positionScreen.copy(ka[0].position);B.multiplyVector4(aa.positionScreen);la=1;for(ha=ka.length;la<ha;la++)if(aa=b(),aa.positionScreen.copy(ka[la].position),B.multiplyVector4(aa.positionScreen),ma=t[n-
|
|
|
+2],J.copy(aa.positionScreen),Q.copy(ma.positionScreen),e(J,Q))J.multiplyScalar(1/J.w),Q.multiplyScalar(1/Q.w),fa=z[A]=z[A]||new THREE.RenderableLine,A++,y=fa,y.v1.positionScreen.copy(J),y.v2.positionScreen.copy(Q),y.z=Math.max(J.z,Q.z),y.materials=Y.materials,N.push(y)}else if(Y instanceof THREE.Particle&&(K.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))fa=D[E]=D[E]||new THREE.RenderableParticle,E++,F=fa,F.x=K.x/K.w,F.y=K.y/K.w,F.z=K.z,F.rotation=
|
|
|
+Y.rotation.z,F.scale.x=Y.scale.x*Math.abs(F.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),F.scale.y=Y.scale.y*Math.abs(F.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),F.materials=Y.materials,N.push(F);h&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
|
|
|
this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
|
|
@@ -78,9 +78,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
|
|
|
e,f,h,k,m,n=new THREE.Vector3,t=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),t.sub(c.position,e.position),n.crossSelf(t);n.isZero()||n.normalize();k.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
|
|
|
Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
|
|
|
THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
|
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,k,h,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=m[k];u=m[h];x=m[o];p=t.x-n.x;y=v.x-n.x;A=t.y-n.y;z=v.y-n.y;F=t.z-n.z;E=v.z-n.z;D=u.u-w.u;G=x.u-w.u;N=u.v-w.v;O=x.v-w.v;K=1/(D*O-G*N);J.set((O*p-N*y)*K,(O*A-N*z)*K,(O*F-N*E)*K);R.set((D*y-G*p)*K,(D*z-G*A)*K,(D*E-G*F)*K);B[e].addSelf(J);B[c].addSelf(J);B[f].addSelf(J);da[e].addSelf(R);
|
|
|
-da[c].addSelf(R);da[f].addSelf(R)}var c,e,f,h,k,m,n,t,v,w,u,x,p,y,A,z,F,E,D,G,N,O,K,H,B=[],da=[],J=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
|
|
|
-"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],H=B[h],S.copy(H),S.subSelf(W.multiplyScalar(W.dot(H))).normalize(),Y.cross(k.vertexNormals[f],H),h=Y.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(S.x,S.y,S.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,k,h,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=m[k];u=m[h];x=m[o];p=t.x-n.x;y=v.x-n.x;A=t.y-n.y;z=v.y-n.y;F=t.z-n.z;E=v.z-n.z;D=u.u-w.u;G=x.u-w.u;N=u.v-w.v;O=x.v-w.v;K=1/(D*O-G*N);J.set((O*p-N*y)*K,(O*A-N*z)*K,(O*F-N*E)*K);Q.set((D*y-G*p)*K,(D*z-G*A)*K,(D*E-G*F)*K);B[e].addSelf(J);B[c].addSelf(J);B[f].addSelf(J);ca[e].addSelf(Q);
|
|
|
+ca[c].addSelf(Q);ca[f].addSelf(Q)}var c,e,f,h,k,m,n,t,v,w,u,x,p,y,A,z,F,E,D,G,N,O,K,H,B=[],ca=[],J=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,U=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,ca[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
|
|
|
+"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)X.copy(k.vertexNormals[f]),h=k[o[f]],H=B[h],R.copy(H),R.subSelf(X.multiplyScalar(X.dot(H))).normalize(),U.cross(k.vertexNormals[f],H),h=U.dot(ca[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;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 c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
|
b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
|
|
|
e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
|
|
@@ -147,44 +147,44 @@ THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addCh
|
|
|
THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var t,v,w,u,x,p,y,A;b=c.projectScene(e,f);t=0;for(v=b.length;t<v;t++)if(x=b[t],x instanceof THREE.RenderableParticle){y=x.x*h+h;A=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=A+"px"}}};
|
|
|
THREE.CanvasRenderer=function(b){function c(b){if(z!=b)p.globalAlpha=z=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}F=b}}function f(b){if(E!=b)p.strokeStyle=E=b}function h(b){if(D!=b)p.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-v,w,u,x,p=t.getContext("2d"),y=new THREE.Color(0),A=0,z=1,F=0,E=null,D=null,G=null,N=null,O=null,K,H,B,da,J=new THREE.RenderableVertex,R=new THREE.RenderableVertex,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca=new THREE.Color(0),$=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ra=[],na,P,oa,qa,wa,ta,Ea,Aa,Ca,Fa,L=new THREE.Rectangle,U=new THREE.Rectangle,M=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
-Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){v=b;w=e;u=Math.floor(v/2);x=Math.floor(w/2);t.width=v;
|
|
|
-t.height=w;L.set(-u,-x,u,x);U.set(-u,-x,u,x);z=1;F=0;O=N=G=D=E=null};this.setClearColor=function(b,e){y.copy(b);A=e;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,e){y.setHex(b);A=e;U.set(-u,-x,u,x)};this.clear=function(){p.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(L),U.inflate(2),A<1&&p.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight())),A>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
-255)+","+A+")"),p.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,v){function t(b){var e,c,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function w(b,e,c,
|
|
|
+v,w,u,x,p=t.getContext("2d"),y=new THREE.Color(0),A=0,z=1,F=0,E=null,D=null,G=null,N=null,O=null,K,H,B,ca,J=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,U,X,o,da,V,la,ha,ka,aa,ma,ea,Z=new THREE.Color(0),$=new THREE.Color(0),Y=new THREE.Color(0),fa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],na,P,oa,qa,wa,ta,Ea,Aa,Ca,Fa,L=new THREE.Rectangle,T=new THREE.Rectangle,M=new THREE.Rectangle,ua=!1,ga=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
+Ia,Da,Ka,Ba,Ga,W,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;W=Ga.getContext("2d");W.translate(-b/2,-b/2);W.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){v=b;w=e;u=Math.floor(v/2);x=Math.floor(w/2);t.width=v;
|
|
|
+t.height=w;L.set(-u,-x,u,x);T.set(-u,-x,u,x);z=1;F=0;O=N=G=D=E=null};this.setClearColor=function(b,e){y.copy(b);A=e;T.set(-u,-x,u,x)};this.setClearColorHex=function(b,e){y.setHex(b);A=e;T.set(-u,-x,u,x)};this.clear=function(){p.setTransform(1,0,0,-1,u,x);T.isEmpty()||(T.minSelf(L),T.inflate(2),A<1&&p.clearRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight())),A>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
+255)+","+A+")"),p.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,v){function t(b){var e,c,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function w(b,e,c,
|
|
|
f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(pa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function y(b,k,m){c(m.opacity);e(m.blending);var o,n,v,t,w,va;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
|
|
|
m.map.image,w=t.width>>1,va=t.height>>1,m=k.scale.x*u,v=k.scale.y*x,o=m*w,n=v*va,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-v),p.translate(-w,-va),p.drawImage(t,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p),
|
|
|
p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)p.lineWidth=G=b;b=m.linecap;if(N!=b)p.lineCap=N=b;b=m.linejoin;if(O!=b)p.lineJoin=O=b;f(m.color.getContextStyle());p.stroke();M.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=3;k.info.render.faces++;c(p.opacity);e(p.blending);
|
|
|
-S=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;Q=h.positionScreen.y;E(S,Y,W,o,ea,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
-ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(S,Y,W,o,ea,Q,wa,ta,Ea,Aa,Ca,Fa,p.envMap)}else p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
|
|
|
-(p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map)),e(THREE.SubtractiveBlending)),ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?($.r=X.r=ga.r=ja.r,$.g=X.g=ga.g=ja.g,$.b=X.b=ga.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,
|
|
|
-Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,
|
|
|
-ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,
|
|
|
-na,P),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)}function F(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,t,p,x),A(n,h,u,1,2,3,t,p,x);else if(S=b.positionScreen.x,
|
|
|
-Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,Q=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=u.positionScreen.x,fa=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
|
|
|
-4?($.r=X.r=ga.r=la.r=ja.r,$.g=X.g=ga.g=la.g=ja.g,$.b=X.b=ga.b=la.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*
|
|
|
-X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),oa=Ya($,X,ga,la),E(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),E(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,
|
|
|
-1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):(D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
-p.wireframeLinejoin):Oa(ca);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,P),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,P),oa=Ya($,X,ga,la),E(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),E(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function D(b,
|
|
|
+R=b.positionScreen.x;U=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;da=h.positionScreen.x;V=h.positionScreen.y;E(R,U,X,o,da,V);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(R,U,X,o,da,V,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
+ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(R,U,X,o,da,V,wa,ta,Ea,Aa,Ca,Fa,p.envMap)}else p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
|
|
|
+(p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(R,U,X,o,da,V,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map)),e(THREE.SubtractiveBlending)),ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?($.r=Y.r=fa.r=ja.r,$.g=Y.g=fa.g=ja.g,$.b=Y.b=fa.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],fa),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,
|
|
|
+Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),Y.r=Math.max(0,Math.min(p.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(p.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(p.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(R,U,X,o,da,V,0,0,1,0,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,t.centroidWorld,t.normalWorld,
|
|
|
+ga),Z.r=Math.max(0,Math.min(p.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ga.b,1)),p.wireframe?Na(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(Z)):p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,P),fa.r=fa.g=fa.b=1-Ra(h.positionScreen.z,na,
|
|
|
+P),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(R,U,X,o,da,V,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Wa(t.normalWorld.x),Z.g=Wa(t.normalWorld.y),Z.b=Wa(t.normalWorld.z),p.wireframe?Na(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(Z)}function F(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,t,p,x),A(n,h,u,1,2,3,t,p,x);else if(R=b.positionScreen.x,
|
|
|
+U=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,da=h.positionScreen.x,V=h.positionScreen.y,la=m.positionScreen.x,ha=m.positionScreen.y,ka=n.positionScreen.x,aa=n.positionScreen.y,ma=u.positionScreen.x,ea=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(R,U,X,o,da,V,la,ha),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
|
|
|
+4?($.r=Y.r=fa.r=ia.r=ja.r,$.g=Y.g=fa.g=ia.g=ja.g,$.b=Y.b=fa.b=ia.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),w(x,t.v4.positionWorld,t.vertexNormalsWorld[3],fa),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ia),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),Y.r=Math.max(0,Math.min(p.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(p.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(p.color.b*
|
|
|
+Y.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),oa=Ya($,Y,fa,ia),E(R,U,X,o,la,ha),Va(R,U,X,o,la,ha,0,0,1,0,0,1,oa),E(ka,aa,da,V,ma,ea),Va(ka,aa,da,V,ma,ea,1,0,1,1,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,t.centroidWorld,t.normalWorld,ga),Z.r=Math.max(0,Math.min(p.color.r*ga.r,
|
|
|
+1)),Z.g=Math.max(0,Math.min(p.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ga.b,1)),D(R,U,X,o,da,V,la,ha),p.wireframe?Na(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(Z)):(D(R,U,X,o,da,V,la,ha),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)Z.r=Wa(t.normalWorld.x),Z.g=Wa(t.normalWorld.y),Z.b=Wa(t.normalWorld.z),D(R,U,X,o,da,V,la,ha),p.wireframe?Na(Z,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
+p.wireframeLinejoin):Oa(Z);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,P),fa.r=fa.g=fa.b=1-Ra(m.positionScreen.z,na,P),ia.r=ia.g=ia.b=1-Ra(h.positionScreen.z,na,P),oa=Ya($,Y,fa,ia),E(R,U,X,o,la,ha),Va(R,U,X,o,la,ha,0,0,1,0,0,1,oa),E(ka,aa,da,V,ma,ea),Va(ka,aa,da,V,ma,ea,1,0,1,1,0,1,oa)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function D(b,
|
|
|
e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Na(b,e,c,k){if(G!=e)p.lineWidth=G=e;if(N!=c)p.lineCap=N=c;if(O!=k)p.lineJoin=O=k;f(b.getContextStyle());p.stroke();M.inflate(e*2)}function Oa(b){h(b.getContextStyle());p.fill()}function ab(b,e,c,f,k,m,o,n,u,t,v,w,va){if(va.image.width!=0){if(va.needsUpdate==!0||ra[va.id]==void 0){var x=va.wrapS==THREE.RepeatWrapping,y=va.wrapT==THREE.RepeatWrapping;ra[va.id]=p.createPattern(va.image,
|
|
|
x&&y?"repeat":x&&!y?"repeat-x":!x&&y?"repeat-y":"no-repeat");va.needsUpdate=!1}h(ra[va.id]);var x=va.offset.x/va.repeat.x,y=va.offset.y/va.repeat.y,L=(va.image.width-1)*va.repeat.x,va=(va.image.height-1)*va.repeat.y,o=(o+x)*L,n=(n+y)*va,u=(u+x)*L,t=(t+y)*va,v=(v+x)*L,w=(w+y)*va;c-=b;f-=e;k-=b;m-=e;u-=o;t-=n;v-=o;w-=n;x=1/(u*w-v*t);va=(w*c-t*k)*x;t=(w*f-t*m)*x;c=(u*k-v*c)*x;f=(u*m-v*f)*x;b=b-va*o-c*n;e=e-t*o-f*n;p.save();p.transform(va,t,c,f,b,e);p.fill();p.restore()}}function Va(b,e,c,f,k,m,h,o,n,
|
|
|
u,t,v,va){var w,x;w=va.width-1;x=va.height-1;h*=w;o*=x;n*=w;u*=x;t*=w;v*=x;c-=b;f-=e;k-=b;m-=e;n-=h;u-=o;t-=h;v-=o;x=1/(n*v-t*u);w=(v*c-u*k)*x;u=(v*f-u*m)*x;c=(n*k-t*c)*x;f=(n*m-t*f)*x;b=b-w*h-c*o;e=e-u*h-f*o;p.save();p.transform(w,u,c,f,b,e);p.clip();p.drawImage(va,0,0);p.restore()}function Ya(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),u=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:k;
|
|
|
-Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=c<0?0:c>255?255:c;Ba[12]=u<0?0:u>255?255:u;Ba[13]=t<0?0:t>255?255:t;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,
|
|
|
+Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=c<0?0:c>255?255:c;Ba[12]=u<0?0:u>255?255:u;Ba[13]=t<0?0:t>255?255:t;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);W.drawImage(Ia,0,0);return Ga}function Ra(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,
|
|
|
f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():p.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,v,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];M.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=u;K.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&y(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,H=sa.v2,
|
|
|
K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),L.intersects(M)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,H,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,H=sa.v2,B=sa.v3,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,
|
|
|
sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),M.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,B.positionScreen.x,B.positionScreen.y),L.intersects(M)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&A(K,H,B,0,1,2,sa,za,b)}else za.opacity!=
|
|
|
-0&&A(K,H,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,H=sa.v2,B=sa.v3,da=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,da.positionScreen.x*=u,da.positionScreen.y*=x,J.positionScreen.copy(H.positionScreen),R.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,da.positionScreen),Pa(da.positionScreen,K.positionScreen),Pa(B.positionScreen,
|
|
|
-J.positionScreen),Pa(B.positionScreen,R.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),M.addPoint(da.positionScreen.x,da.positionScreen.y),L.intersects(M))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&F(K,H,B,da,J,R,sa,za,b)}else za.opacity!=
|
|
|
-0&&F(K,H,B,da,J,R,sa,za,b)}U.addRectangle(M)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,e.centroidWorld),da.normalize(),m=e.normalWorld.dot(da)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,m,o,n,p){k.info.render.vertices+=3;k.info.render.faces++;S=f(Y++);
|
|
|
-S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(p,o,N),G.r=Math.max(0,Math.min(n.color.r*N.r,1)),G.g=Math.max(0,Math.min(n.color.g*N.g,1)),G.b=Math.max(0,Math.min(n.color.b*N.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
|
|
|
-o.z*n.__farMinusNear),G.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?S.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(S)}function e(e,c,m,n,o,p,u){k.info.render.vertices+=
|
|
|
-4;k.info.render.faces++;S=f(Y++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(u,o,N),G.r=Math.max(0,Math.min(p.color.r*N.r,1)),G.g=Math.max(0,Math.min(p.color.g*N.g,1)),G.b=Math.max(0,Math.min(p.color.b*N.b,1))):
|
|
|
-G.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),G.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));p.wireframe?S.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):S.setAttribute("style","fill: "+G.getContextStyle()+
|
|
|
-"; fill-opacity: "+p.opacity);t.appendChild(S)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,A,z,F=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0),
|
|
|
-K=new THREE.Color(0),H=new THREE.Color(0),B,da=new THREE.Vector3,J=[],R=[],S,Y,W,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;w=e;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);F.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
-this.render=function(b,f){var h,v,w,G,N,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=Y=0;if(D=b.lights.length>0){B=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(v=B.length;h<v;h++)w=B[h],G=w.color,w instanceof THREE.AmbientLight?(O.r+=G.r,O.g+=G.g,O.b+=G.b):w instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):w instanceof THREE.PointLight&&(H.r+=G.r,H.g+=G.g,H.b+=G.b)}h=0;for(v=m.length;h<
|
|
|
-v;h++)if(B=m[h],E.empty(),B instanceof THREE.RenderableParticle){p=B;p.x*=u;p.y*=-x;w=0;for(G=B.materials.length;w<G;)w++}else if(B instanceof THREE.RenderableLine){if(p=B.v1,y=B.v2,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),F.intersects(E)){w=0;for(G=B.materials.length;w<G;)if(($=B.materials[w++])&&$.opacity!=0){N=p;J=y;var X=W++;R[X]==null&&(R[X]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),o==0&&R[X].setAttribute("shape-rendering","crispEdges"));S=R[X];S.setAttribute("x1",N.positionScreen.x);S.setAttribute("y1",N.positionScreen.y);S.setAttribute("x2",J.positionScreen.x);S.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(S.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),t.appendChild(S))}}}else if(B instanceof
|
|
|
+0&&A(K,H,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,H=sa.v2,B=sa.v3,ca=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,ca.positionScreen.x*=u,ca.positionScreen.y*=x,J.positionScreen.copy(H.positionScreen),Q.positionScreen.copy(ca.positionScreen),sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,ca.positionScreen),Pa(ca.positionScreen,K.positionScreen),Pa(B.positionScreen,
|
|
|
+J.positionScreen),Pa(B.positionScreen,Q.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),M.addPoint(ca.positionScreen.x,ca.positionScreen.y),L.intersects(M))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&F(K,H,B,ca,J,Q,sa,za,b)}else za.opacity!=
|
|
|
+0&&F(K,H,B,ca,J,Q,sa,za,b)}T.addRectangle(M)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(ca.sub(h.position,e.centroidWorld),ca.normalize(),m=e.normalWorld.dot(ca)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,m,o,n,p){k.info.render.vertices+=3;k.info.render.faces++;R=f(U++);
|
|
|
+R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(p,o,N),G.r=Math.max(0,Math.min(n.color.r*N.r,1)),G.g=Math.max(0,Math.min(n.color.g*N.g,1)),G.b=Math.max(0,Math.min(n.color.b*N.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
|
|
|
+o.z*n.__farMinusNear),G.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(R)}function e(e,c,m,o,n,p,u){k.info.render.vertices+=
|
|
|
+4;k.info.render.faces++;R=f(U++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(u,n,N),G.r=Math.max(0,Math.min(p.color.r*N.r,1)),G.g=Math.max(0,Math.min(p.color.g*N.g,1)),G.b=Math.max(0,Math.min(p.color.b*N.b,1))):
|
|
|
+G.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),G.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style","fill: "+G.getContextStyle()+
|
|
|
+"; fill-opacity: "+p.opacity);t.appendChild(R)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,A,z,F=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0),
|
|
|
+K=new THREE.Color(0),H=new THREE.Color(0),B,ca=new THREE.Vector3,J=[],Q=[],R,U,X,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;w=e;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);F.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
+this.render=function(b,f){var h,v,w,G,N,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);X=U=0;if(D=b.lights.length>0){B=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(v=B.length;h<v;h++)w=B[h],G=w.color,w instanceof THREE.AmbientLight?(O.r+=G.r,O.g+=G.g,O.b+=G.b):w instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):w instanceof THREE.PointLight&&(H.r+=G.r,H.g+=G.g,H.b+=G.b)}h=0;for(v=m.length;h<
|
|
|
+v;h++)if(B=m[h],E.empty(),B instanceof THREE.RenderableParticle){p=B;p.x*=u;p.y*=-x;w=0;for(G=B.materials.length;w<G;)w++}else if(B instanceof THREE.RenderableLine){if(p=B.v1,y=B.v2,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),F.intersects(E)){w=0;for(G=B.materials.length;w<G;)if(($=B.materials[w++])&&$.opacity!=0){N=p;J=y;var Y=X++;Q[Y]==null&&(Q[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),o==0&&Q[Y].setAttribute("shape-rendering","crispEdges"));R=Q[Y];R.setAttribute("x1",N.positionScreen.x);R.setAttribute("y1",N.positionScreen.y);R.setAttribute("x2",J.positionScreen.x);R.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),t.appendChild(R))}}}else if(B instanceof
|
|
|
THREE.RenderableFace3){if(p=B.v1,y=B.v2,A=B.v3,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),F.intersects(E)){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&
|
|
|
$.opacity!=0&&c(p,y,A,B,$,b)}else $&&$.opacity!=0&&c(p,y,A,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(p=B.v1,y=B.v2,A=B.v3,z=B.v4,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),
|
|
|
F.intersects(E))){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&$.opacity!=0&&e(p,y,A,z,B,$,b)}else $&&$.opacity!=0&&e(p,y,A,z,B,$,b)}}};
|
|
@@ -223,113 +223,113 @@ THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.len
|
|
|
for(f=0;f<u;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(L)for(z in L){f=L[z];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")M=f.value[index];f.size===2?(f.array[u]=M.x,f.array[u+1]=M.y):f.size===3?f.type==="c"?(f.array[u]=M.r,f.array[u+1]=M.g,f.array[u+2]=M.b):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z):(f.array[u]=
|
|
|
M.x,f.array[u+1]=M.y,f.array[u+2]=M.z,f.array[u+3]=M.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;if(y)for(f=0;f<u;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(L)for(z in L)if(f=L[z],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")M=f.value[h];f.size===2?(f.array[u]=
|
|
|
M.x,f.array[u+1]=M.y):f.size===3?f.type==="c"?(f.array[u]=M.r,f.array[u+1]=M.g,f.array[u+2]=M.b):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z,f.array[u+3]=M.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,e);if(y||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,e);if(L)for(z in L)if(f=L[z],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||W.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,p=f.uniforms;h!=Q&&(o.useProgram(h),Q=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(p.fogColor.value=c.color,c instanceof
|
|
|
-THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var u,t,v=0,w=0,x=0,y,z,M,A=Fa,U=A.directional.colors,F=A.directional.positions,E=A.point.colors,D=A.point.positions,G=A.point.distances,na=0,ua=0,c=u=M=0,n=e.length;c<n;c++)if(u=e[c],t=u.color,y=u.position,z=u.intensity,M=u.distance,u instanceof THREE.AmbientLight)v+=t.r,w+=t.g,x+=t.b;else if(u instanceof
|
|
|
-THREE.DirectionalLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,F[M]=y.x,F[M+1]=y.y,F[M+2]=y.z,na+=1;else if(u instanceof THREE.SpotLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,t=1/y.length(),F[M]=y.x*t,F[M+1]=y.y*t,F[M+2]=y.z*t,na+=1;else if(u instanceof THREE.PointLight)u=ua*3,E[u]=t.r*z,E[u+1]=t.g*z,E[u+2]=t.b*z,D[u]=y.x,D[u+1]=y.y,D[u+2]=y.z,G[ua]=M,ua+=1;c=na*3;for(n=U.length;c<n;c++)U[c]=0;c=ua*3;for(n=E.length;c<n;c++)E[c]=0;A.point.length=ua;A.directional.length=na;A.ambient[0]=v;
|
|
|
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||X.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(X.maxMorphTargets);for(var h=0,m=X.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,p=f.uniforms;h!=V&&(o.useProgram(h),V=h,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(p.fogColor.value=c.color,c instanceof
|
|
|
+THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var u,t,v=0,w=0,x=0,y,z,M,A=Fa,T=A.directional.colors,F=A.directional.positions,E=A.point.colors,D=A.point.positions,G=A.point.distances,na=0,ua=0,c=u=M=0,n=e.length;c<n;c++)if(u=e[c],t=u.color,y=u.position,z=u.intensity,M=u.distance,u instanceof THREE.AmbientLight)v+=t.r,w+=t.g,x+=t.b;else if(u instanceof
|
|
|
+THREE.DirectionalLight)M=na*3,T[M]=t.r*z,T[M+1]=t.g*z,T[M+2]=t.b*z,F[M]=y.x,F[M+1]=y.y,F[M+2]=y.z,na+=1;else if(u instanceof THREE.SpotLight)M=na*3,T[M]=t.r*z,T[M+1]=t.g*z,T[M+2]=t.b*z,t=1/y.length(),F[M]=y.x*t,F[M+1]=y.y*t,F[M+2]=y.z*t,na+=1;else if(u instanceof THREE.PointLight)u=ua*3,E[u]=t.r*z,E[u+1]=t.g*z,E[u+2]=t.b*z,D[u]=y.x,D[u+1]=y.y,D[u+2]=y.z,G[ua]=M,ua+=1;c=na*3;for(n=T.length;c<n;c++)T[c]=0;c=ua*3;for(n=E.length;c<n;c++)E[c]=0;A.point.length=ua;A.directional.length=na;A.ambient[0]=v;
|
|
|
A.ambient[1]=w;A.ambient[2]=x;e=Fa;p.enableLighting.value=e.directional.length+e.point.length;p.ambientLightColor.value=e.ambient;p.directionalLightColor.value=e.directional.colors;p.directionalLightDirection.value=e.directional.positions;p.pointLightColor.value=e.point.colors;p.pointLightPosition.value=e.point.positions;p.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=
|
|
|
f.color,p.opacity.value=f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=
|
|
|
f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=L.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(e=0;e<pa.length;e++)p.shadowMatrix.value[e]=
|
|
|
-pa[e],p.shadowMap.texture[e]=W.shadowMap[e];p.shadowDarkness.value=W.shadowMapDarkness;p.shadowBias.value=W.shadowMapBias}e=f.uniformsList;p=0;for(c=e.length;p<c;p++)if(w=h.uniforms[e[p][1]])if(v=e[p][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
|
|
|
+pa[e],p.shadowMap.texture[e]=X.shadowMap[e];p.shadowDarkness.value=X.shadowMapDarkness;p.shadowBias.value=X.shadowMapBias}e=f.uniformsList;p=0;for(c=e.length;p<c;p++)if(w=h.uniforms[e[p][1]])if(v=e[p][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
|
|
|
n);else if(x=="v3v"){if(!v._array)v._array=new Float32Array(3*n.length);x=0;for(y=n.length;x<y;x++)A=x*3,v._array[A]=n[x].x,v._array[A+1]=n[x].y,v._array[A+2]=n[x].z;o.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);x=0;for(y=n.length;x<y;x++)n[x].flattenToArrayOffset(v._array,x*16);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(o.uniform1i(w,
|
|
|
n),w=v.texture)if(w.image instanceof Array&&w.image.length==6){if(v=w,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);H(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof
|
|
|
THREE.WebGLRenderTargetCube?(v=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):B(w,n)}else if(x=="tv"){if(!v._array){v._array=[];x=0;for(y=v.texture.length;x<y;x++)v._array[x]=n+x}o.uniform1iv(w,v._array);x=0;for(y=v.texture.length;x<y;x++)(w=v.texture[x])&&B(w,v._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
|
|
|
THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
|
|
|
-m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ia&&(ia=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
|
|
|
+m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ka&&(ka=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
|
|
|
o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,u=m.morphTargetForcedOrder,v=m.morphTargetInfluences;p<k.numSupportedMorphTargets&&p<u.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=v[u[p]],p++;else{var u=[],t=-1,
|
|
|
w=0,v=m.morphTargetInfluences,x,y=v.length,p=0;for(m.morphTargetBase!==-1&&(u[m.morphTargetBase]=!0);p<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!u[x]&&v[x]>t&&(w=x,t=v[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=t;u[w]=1;t=-1;p++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
|
|
|
0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
|
|
|
o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,
|
|
|
-o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
|
|
|
-m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),X.info.render.calls++):
|
|
|
+m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),X.info.render.calls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,u,v,t,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],p=c[w+4],v=c[w+5],n=c[w+6],u=c[w+7],t=c[w+8],f=(f+m+n)/3,h=(h+p+u)/3,k=(k+v+t)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+6]=f,c[w+7]=h,c[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
|
|
|
-0,b.count);b.count=0}function k(b){if(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){X!=b&&(o.depthMask(b),X=b)}function t(b,e,c){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=e||ra!=c))o.polygonOffset(e,c),la=e,ra=c}function v(b){wa[0].set(b.n41-
|
|
|
+0,b.count);b.count=0}function k(b){if(ma!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ma=b.doubleSided;if(ea!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ea=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){Y!=b&&(o.depthMask(b),Y=b)}function t(b,e,c){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(ia!=e||ra!=c))o.polygonOffset(e,c),ia=e,ra=c}function v(b){wa[0].set(b.n41-
|
|
|
b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=wa[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=wa[f].x*e.n14+wa[f].y*e.n24+wa[f].z*e.n34+wa[f].w,b<=c)return!1;return!0}function u(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?u(k,c):u(h,c)}function p(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=
|
|
|
-0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?u(o,h):u(n,h))}else(h=e)&&(h.transparent?u(o,h):u(n,h))}function y(b,e){return e.z-b.z}function A(b){var c,n,p,u=0,t,x,y,L,z=b.lights;if(!xa)xa=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar),xa.useTarget=!0;c=0;for(n=z.length;c<n;c++)if(p=z[c],p instanceof THREE.SpotLight&&p.castShadow){Z=-1;W.shadowMap[u]||(W.shadowMap[u]=new THREE.WebGLRenderTarget(W.shadowMapWidth,
|
|
|
-W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);t=W.shadowMap[u];x=pa[u];xa.position.copy(p.position);xa.target.position.copy(p.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(xa.projectionMatrix);x.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Aa);xa.projectionMatrix.flattenToArray(Ea);ta.multiply(xa.projectionMatrix,
|
|
|
-xa.matrixWorldInverse);v(ta);W.initWebGLObjects(b);da(t);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(t=0;t<x;t++)y=b.__webglObjects[t],L=y.object,L.visible&&L.castShadow?!(L instanceof THREE.Mesh)||!L.frustumCulled||w(L)?(L.matrixWorld.flattenToArray(L._objectMatrixArray),F(L,xa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(t=0;t<x;t++)if(y=b.__webglObjects[t],y.render)L=y.object,buffer=
|
|
|
-y.buffer,k(L),y=L.customDepthMaterial?L.customDepthMaterial:L.geometry.morphTargets.length?Ka:Da,f(xa,z,null,y,buffer,L);for(t=0;t<p;t++)y=b.__webglObjectsImmediate[t],L=y.object,L.visible&&L.castShadow&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),F(L,xa,!1),k(L),program=e(xa,z,null,Da,L),L.immediateRenderCallback?L.immediateRenderCallback(program,o,wa):L.render(function(b){h(b,program,Da.shading)}));u++}}function z(b,e){var c,f,h;c=V.attributes;var k=V.uniforms,m=qa/oa,
|
|
|
-n,p=[],u=oa*0.5,t=qa*0.5,v=!0;o.useProgram(V.program);Q=V.program;ia=$=ca=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);
|
|
|
+0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?u(o,h):u(n,h))}else(h=e)&&(h.transparent?u(o,h):u(n,h))}function y(b,e){return e.z-b.z}function A(b){var c,n,p,u=0,t,x,y,L,z=b.lights;if(!xa)xa=new THREE.Camera(X.shadowCameraFov,X.shadowMapWidth/X.shadowMapHeight,X.shadowCameraNear,X.shadowCameraFar),xa.useTarget=!0;c=0;for(n=z.length;c<n;c++)if(p=z[c],p instanceof THREE.SpotLight&&p.castShadow){ha=-1;X.shadowMap[u]||(X.shadowMap[u]=new THREE.WebGLRenderTarget(X.shadowMapWidth,
|
|
|
+X.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);t=X.shadowMap[u];x=pa[u];xa.position.copy(p.position);xa.target.position.copy(p.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(xa.projectionMatrix);x.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Aa);xa.projectionMatrix.flattenToArray(Ea);ta.multiply(xa.projectionMatrix,
|
|
|
+xa.matrixWorldInverse);v(ta);X.initWebGLObjects(b);ca(t);o.clearColor(1,1,1,1);X.clear();o.clearColor(ga.r,ga.g,ga.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(t=0;t<x;t++)y=b.__webglObjects[t],L=y.object,L.visible&&L.castShadow?!(L instanceof THREE.Mesh)||!L.frustumCulled||w(L)?(L.matrixWorld.flattenToArray(L._objectMatrixArray),F(L,xa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(t=0;t<x;t++)if(y=b.__webglObjects[t],y.render)L=y.object,buffer=
|
|
|
+y.buffer,k(L),y=L.customDepthMaterial?L.customDepthMaterial:L.geometry.morphTargets.length?Ka:Da,f(xa,z,null,y,buffer,L);for(t=0;t<p;t++)y=b.__webglObjectsImmediate[t],L=y.object,L.visible&&L.castShadow&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),F(L,xa,!1),k(L),program=e(xa,z,null,Da,L),L.immediateRenderCallback?L.immediateRenderCallback(program,o,wa):L.render(function(b){h(b,program,Da.shading)}));u++}}function z(b,e){var c,f,h;c=W.attributes;var k=W.uniforms,m=qa/oa,
|
|
|
+n,p=[],u=oa*0.5,t=qa*0.5,v=!0;o.useProgram(W.program);V=W.program;ka=$=Z=-1;Ja||(o.enableVertexAttribArray(W.attributes.position),o.enableVertexAttribArray(W.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);
|
|
|
o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)if(h=b.__webglSprites[c],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,
|
|
|
(h.position.x-u)/u,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),p[0]=n*m*h.scale.x,p[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),
|
|
|
-o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(X)}function F(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
+o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Y)}function F(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
function E(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}
|
|
|
var c,f,h,k,m,n,o,p,u={},t=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),u[o]==void 0&&(u[o]={hash:o,counter:0}),p=u[o].hash+"_"+u[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(u[o].counter+=1,p=u[o].hash+"_"+u[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
|
|
|
-materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function O(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
|
|
|
-o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ca=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(e.magFilter)),
|
|
|
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,S(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(e.minFilter)))}function B(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
-THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
|
|
|
-b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(b.format),b.width,b.height,0,Y(b.format),Y(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,Y(b.format),
|
|
|
-b.width,b.height,0,Y(b.format),Y(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
|
|
|
+materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function O(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=Z){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
|
|
|
+o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}Z=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,U(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,U(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,U(e.magFilter)),
|
|
|
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,R(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,R(e.minFilter)))}function B(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
+THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.image.width,b.image.height,0,U(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function ca(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
|
|
|
+b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,U(b.format),
|
|
|
+b.width,b.height,0,U(b.format),U(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
|
|
|
o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
-null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=oa,b=qa,f=na,h=P);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
|
|
|
-o.bindTexture(o.TEXTURE_2D,null))}function R(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(e),null;return c}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
|
|
|
+null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=oa,b=qa,f=na,h=P);e!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),la=e)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
|
|
|
+o.bindTexture(o.TEXTURE_2D,null))}function Q(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(e),null;return c}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function U(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
|
|
|
case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;
|
|
|
-case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,ea=[],Q=null,
|
|
|
-ma=null,Z=-1,ia=null,aa=0,ka=null,fa=null,ca=null,$=null,X=null,ga=null,la=null,ra=null,na=0,P=0,oa=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},L=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U=
|
|
|
-b.stencil!==void 0?b.stencil:!0,M=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=L;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
+case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var X=this,o,da=[],V=null,
|
|
|
+la=null,ha=-1,ka=null,aa=0,ma=null,ea=null,Z=null,$=null,Y=null,fa=null,ia=null,ra=null,na=0,P=0,oa=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},L=b.canvas!==void 0?b.canvas:document.createElement("canvas"),T=
|
|
|
+b.stencil!==void 0?b.stencil:!0,M=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=L;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
!0;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=!0;var xa,pa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
|
|
|
-uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=L.getContext("experimental-webgl",{antialias:ua,stencil:U,preserveDrawingBuffer:M})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
|
|
|
-o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ha.r,ha.g,ha.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);U=0;V.vertices[U++]=-1;V.vertices[U++]=-1;V.vertices[U++]=0;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=
|
|
|
-1;V.vertices[U++]=1;V.vertices[U++]=0;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=0;U=V.vertices[U++]=0;V.faces[U++]=0;V.faces[U++]=1;V.faces[U++]=2;V.faces[U++]=0;V.faces[U++]=2;V.faces[U++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();
|
|
|
-o.attachShader(V.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");
|
|
|
-V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,
|
|
|
-"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){L.width=b;L.height=e;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(b,e,c,f){na=b;P=e;oa=c;qa=f;o.viewport(na,P,oa,qa)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
-function(b,e){ha.setHex(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearColor=function(b,e){ha.copy(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ja};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(e==void 0||e)f|=o.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
|
|
|
+uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=L.getContext("experimental-webgl",{antialias:ua,stencil:T,preserveDrawingBuffer:M})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
|
|
|
+o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);T=0;W.vertices[T++]=-1;W.vertices[T++]=-1;W.vertices[T++]=0;W.vertices[T++]=1;W.vertices[T++]=1;W.vertices[T++]=-1;W.vertices[T++]=1;W.vertices[T++]=1;W.vertices[T++]=1;W.vertices[T++]=
|
|
|
+1;W.vertices[T++]=1;W.vertices[T++]=0;W.vertices[T++]=-1;W.vertices[T++]=1;W.vertices[T++]=0;T=W.vertices[T++]=0;W.faces[T++]=0;W.faces[T++]=1;W.faces[T++]=2;W.faces[T++]=0;W.faces[T++]=2;W.faces[T++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=o.createProgram();
|
|
|
+o.attachShader(W.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,"rotation");
|
|
|
+W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program,"alignment");W.uniforms.color=o.getUniformLocation(W.program,"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=o.getUniformLocation(W.program,
|
|
|
+"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=o.getUniformLocation(W.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){L.width=b;L.height=e;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(b,e,c,f){na=b;P=e;oa=c;qa=f;o.viewport(na,P,oa,qa)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
+function(b,e){ga.setHex(b);ja=e;o.clearColor(ga.r,ga.g,ga.b,ja)};this.setClearColor=function(b,e){ga.copy(b);ja=e;o.clearColor(ga.r,ga.g,ga.b,ja)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ja};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(e==void 0||e)f|=o.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
|
|
|
delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);
|
|
|
-o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
|
|
|
-W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
|
|
|
+o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);X.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
|
|
|
+X.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),X.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
|
|
|
b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var u,t,v;u=v=p=0;for(t=e.length;u<t;u++)m=e[u],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
|
|
|
p++;p+v<=ya?u=v:(u=Math.ceil(ya*v/(p+v)),p=ya-u);m={directional:u,point:p};p=v=0;for(u=e.length;p<u;p++)t=e[p],t instanceof THREE.SpotLight&&t.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{u=b.fragmentShader;t=b.vertexShader;var p=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(u),f.push(t));for(y in c)f.push(y),f.push(c[y]);n=f.join();y=0;for(f=ea.length;y<f;y++)if(ea[y].code==n){x=ea[y].program;break a}y=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,
|
|
|
+maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(u),f.push(t));for(y in c)f.push(y),f.push(c[y]);n=f.join();y=0;for(f=da.length;y<f;y++)if(da[y].code==n){x=da[y].program;break a}y=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,
|
|
|
"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.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");
|
|
|
m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",
|
|
|
-c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,R("fragment",m+u));o.attachShader(y,R("vertex",f+t));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
+c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,Q("fragment",m+u));o.attachShader(y,Q("vertex",f+t));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
o.getError()+"]");y.uniforms={};y.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in p)f.push(L);L=f;f=0;for(p=L.length;f<p;f++)u=L[f],y.uniforms[u]=o.getUniformLocation(y,u);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(x in e)f.push(x);
|
|
|
-x=f;L=0;for(e=x.length;L<e;L++)c=x[L],y.attributes[c]=o.getAttribLocation(y,c);y.id=ea.length;ea.push({program:y,code:n});W.info.memory.programs=ea.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
|
|
|
-o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)L="morphTarget"+k,x[L]>=0&&(o.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){da(b);
|
|
|
-this.clear(e,c,f)};this.render=function(b,c,u,L){var M,U,E,D,G,na,B,H,ua=b.lights,N=b.fog;Z=-1;this.shadowMapEnabled&&A(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ta);this.initWebGLObjects(b);da(u);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+x=f;L=0;for(e=x.length;L<e;L++)c=x[L],y.attributes[c]=o.getAttribLocation(y,c);y.id=da.length;da.push({program:y,code:n});X.info.memory.programs=da.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
|
|
|
+o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)L="morphTarget"+k,x[L]>=0&&(o.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){ca(b);
|
|
|
+this.clear(e,c,f)};this.render=function(b,c,u,L){var M,T,E,D,G,na,B,H,ua=b.lights,N=b.fog;ha=-1;this.shadowMapEnabled&&A(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ta);this.initWebGLObjects(b);ca(u);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
G=b.__webglObjects.length;for(L=0;L<G;L++)if(M=b.__webglObjects[L],B=M.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),p(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),M.z=Ca.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(y);na=b.__webglObjectsImmediate.length;for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],
|
|
|
-B=M.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),x(M));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render)B=M.object,H=M.buffer,k(B),f(c,ua,N,b.overrideMaterial,H,B);for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],B=M.object,B.visible&&(k(B),U=e(c,ua,N,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,
|
|
|
-Da.shading)}))}else{K(THREE.NormalBlending);for(L=G-1;L>=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;H=M.buffer;E=M.opaque;k(B);for(M=0;M<E.count;M++)D=E.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,H,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){E=M.opaque;k(B);for(M=0;M<E.count;M++)D=E.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,
|
|
|
-ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render){B=M.object;H=M.buffer;E=M.transparent;k(B);for(M=0;M<E.count;M++)D=E.list[M],K(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,H,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){E=M.transparent;k(B);for(M=0;M<E.count;M++)D=E.list[M],K(D.blending),
|
|
|
-m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}}b.__webglSprites.length&&z(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
+B=M.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),x(M));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render)B=M.object,H=M.buffer,k(B),f(c,ua,N,b.overrideMaterial,H,B);for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],B=M.object,B.visible&&(k(B),T=e(c,ua,N,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,wa):B.render(function(b){h(b,T,
|
|
|
+Da.shading)}))}else{K(THREE.NormalBlending);for(L=G-1;L>=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;H=M.buffer;E=M.opaque;k(B);for(M=0;M<E.count;M++)D=E.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,H,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){E=M.opaque;k(B);for(M=0;M<E.count;M++)D=E.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),T=e(c,
|
|
|
+ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,wa):B.render(function(b){h(b,T,Da.shading)})}for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render){B=M.object;H=M.buffer;E=M.transparent;k(B);for(M=0;M<E.count;M++)D=E.list[M],K(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,H,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){E=M.transparent;k(B);for(M=0;M<E.count;M++)D=E.list[M],K(D.blending),
|
|
|
+m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),T=e(c,ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,wa):B.render(function(b){h(b,T,Da.shading)})}}b.__webglSprites.length&&z(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
f=b,h=void 0,k=void 0,m=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)for(h in k=e.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();
|
|
|
n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var p=void 0,u=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(u=n.numMorphTargets;p<
|
|
|
-u;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,t=void 0,v=void 0,x=void 0,w=x=void 0,L=void 0,y=void 0,M=y=p=0,z=x=v=void 0,x=u=z=v=t=void 0,w=n.geometry,L=w.faces,z=m.faces,t=0,v=z.length;t<v;t++)x=z[t],x=L[x],x instanceof THREE.Face3?(p+=3,y+=1,M+=3):x instanceof THREE.Face4&&(p+=4,y+=2,M+=4);for(var t=m,v=n,A=z=L=void 0,U=void 0,A=void 0,x=[],L=0,z=v.materials.length;L<z;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<
|
|
|
-l;A++)(U=t.materials[A])&&x.push(U)}else(U=A)&&x.push(U);t=x;m.__materials=t;a:{L=v=void 0;z=t.length;for(v=0;v<z;v++)if(L=t[v],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{z=L=void 0;x=t.length;for(L=0;L<x;L++)if(z=t[L],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{x=L=void 0;A=t.length;for(L=0;L<A;L++)if(x=t[L],x.vertexColors){x=
|
|
|
+u;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}X.info.memory.geometries++;for(var n=e,t=void 0,v=void 0,x=void 0,w=x=void 0,L=void 0,y=void 0,M=y=p=0,z=x=v=void 0,x=u=z=v=t=void 0,w=n.geometry,L=w.faces,z=m.faces,t=0,v=z.length;t<v;t++)x=z[t],x=L[x],x instanceof THREE.Face3?(p+=3,y+=1,M+=3):x instanceof THREE.Face4&&(p+=4,y+=2,M+=4);for(var t=m,v=n,A=z=L=void 0,T=void 0,A=void 0,x=[],L=0,z=v.materials.length;L<z;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<
|
|
|
+l;A++)(T=t.materials[A])&&x.push(T)}else(T=A)&&x.push(T);t=x;m.__materials=t;a:{L=v=void 0;z=t.length;for(v=0;v<z;v++)if(L=t[v],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{z=L=void 0;x=t.length;for(L=0;L<x;L++)if(z=t[L],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{x=L=void 0;A=t.length;for(L=0;L<A;L++)if(x=t[L],x.vertexColors){x=
|
|
|
x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(p*3);if(z)m.__normalArray=new Float32Array(p*3);if(w.hasTangents)m.__tangentArray=new Float32Array(p*4);if(x)m.__colorArray=new Float32Array(p*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=
|
|
|
new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(M*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(L=m.numMorphTargets;w<L;w++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=z==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=z;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
|
|
|
n.geometry.edgeFaces.length*6:0);m.__webglLineCount=M*2;w=0;for(L=t.length;w<L;w++)if(v=t[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];z={};for(u in x)z[u]=x[u];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,y=1,z.type==="v2"?y=2:z.type==="v3"?y=3:z.type==="v4"?y=4:z.type==="c"&&(y=3),z.size=y,z.array=new Float32Array(p*y),z.buffer=o.createBuffer(),z.buffer.belongsToAttribute=a,x.needsUpdate=!0,
|
|
|
-z.__original=x;m.__webglCustomAttributes[a]=z}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
|
|
|
-n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
|
|
|
-m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;M=y=u=void 0;u=0;for(y=n.materials.length;u<y;u++)if(M=n.materials[u],M.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in M.attributes){originalAttribute=M.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
+z.__original=x;m.__webglCustomAttributes[a]=z}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
|
|
|
+n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
|
|
|
+m.__webglColorBuffer=o.createBuffer();X.info.geometries++;m=k;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;M=y=u=void 0;u=0;for(y=n.materials.length;u<y;u++)if(M=n.materials[u],M.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in M.attributes){originalAttribute=M.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(p*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
|
|
|
!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],O(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,O(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
|
|
|
e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
|
|
|
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,u=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],u=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||u)if(u=m,y=o.DYNAMIC_DRAW,M=!h.dynamic,u.__inittedArrays){var F=t=w=void 0,B=void 0,na=F=void 0,H=void 0,ua=void 0,ja=void 0,J=U=A=x=z=L=v=void 0,ha=void 0,K=void 0,
|
|
|
-I=B=ja=B=ua=H=void 0,C=void 0,P=C=I=H=void 0,X=void 0,R=P=C=I=F=F=na=ja=B=P=C=I=X=P=C=I=X=P=C=I=void 0,S=0,oa=0,$=0,da=0,qa=0,Y=0,Q=0,ya=0,V=0,T=0,pa=0,P=I=0,P=void 0,ga=u.__vertexArray,xa=u.__uvArray,wa=u.__uv2Array,la=u.__normalArray,ia=u.__tangentArray,ca=u.__colorArray,aa=u.__skinVertexAArray,Z=u.__skinVertexBArray,ea=u.__skinIndexArray,fa=u.__skinWeightArray,Da=u.__morphTargetsArrays,ka=u.__webglCustomAttributes,C=void 0,ma=u.__faceArray,ra=u.__lineArray,Ia=u.__needsSmoothNormals,L=u.__vertexColorType,
|
|
|
-v=u.__uvType,z=u.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=u.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;w=0;for(t=cb.length;w<t;w++)if(F=cb[w],B=fb[F],db&&(x=db[F]),eb&&(A=eb[F]),F=
|
|
|
-B.vertexNormals,na=B.normal,H=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,oa+=9;if(ka)for(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
|
|
|
-C.boundTo==="faces"?(P=C.value[P],C.array[I]=P,C.array[I+1]=P,C.array[I+2]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],J=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=J=U=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[P],J=C.value[P+1],ha=C.value[P+2],C.offsetSrc+=3),C.size===2?(C.array[I]=U.x,C.array[I+1]=
|
|
|
-U.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=U.r,C.array[I+1]=U.g,C.array[I+2]=U.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,C.array[I+8]=ha.z),C.offset+=9):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=U.w,
|
|
|
-C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)U=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,P=Da[I],P[pa]=U.x,P[pa+1]=U.y,P[pa+2]=U.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ha.x,P[pa+7]=ha.y,P[pa+8]=ha.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],fa[T]=I.x,fa[T+1]=I.y,fa[T+2]=I.z,fa[T+3]=I.w,fa[T+
|
|
|
-4]=C.x,fa[T+5]=C.y,fa[T+6]=C.z,fa[T+7]=C.w,fa[T+8]=P.x,fa[T+9]=P.y,fa[T+10]=P.z,fa[T+11]=P.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],ea[T]=I.x,ea[T+1]=I.y,ea[T+2]=I.z,ea[T+3]=I.w,ea[T+4]=C.x,ea[T+5]=C.y,ea[T+6]=C.z,ea[T+7]=C.w,ea[T+8]=P.x,ea[T+9]=P.y,ea[T+10]=P.z,ea[T+11]=P.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],aa[T]=I.x,aa[T+1]=I.y,aa[T+2]=I.z,aa[T+3]=1,aa[T+4]=C.x,aa[T+5]=C.y,aa[T+6]=C.z,aa[T+7]=1,aa[T+8]=P.x,aa[T+9]=P.y,aa[T+10]=P.z,aa[T+11]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,Z[T+3]=
|
|
|
-1,Z[T+4]=C.x,Z[T+5]=C.y,Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,T+=12;if(Ca&&L)H.length==3&&L==THREE.VertexColors?(B=H[0],I=H[1],C=H[2]):C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ia[Q]=H.x,ia[Q+1]=H.y,ia[Q+2]=H.z,ia[Q+3]=H.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,Q+=12;if(Ga&&z)if(F.length==
|
|
|
-3&&Ia)for(ja=0;ja<3;ja++)na=F[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<3;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<3;ja++)F=x[ja],xa[$]=F.u,xa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)F=A[ja],wa[da]=F.u,wa[da+1]=F.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+2,qa+=3,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+2,ra[ya+4]=S+1,ra[ya+5]=S+2,ya+=6,S+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
-ha=Ja[B.c].position,K=Ja[B.d].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,ga[oa+9]=K.x,ga[oa+10]=K.y,ga[oa+11]=K.z,oa+=12;if(ka)for(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(P=C.value[P],C.array[I]=P,C.array[I+1]=
|
|
|
-P,C.array[I+2]=P,C.array[I+3]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.array[I+3]=C.value[P+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],J=C.value[B.b],ha=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ha=J=U=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[P],J=C.value[P+1],ha=C.value[P+2],K=C.value[P+3],C.offsetSrc+=4),C.size===2?(C.array[I]=U.x,
|
|
|
-C.array[I+1]=U.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=U.r,C.array[I+1]=U.g,C.array[I+2]=U.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,
|
|
|
-C.array[I+8]=ha.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=U.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)U=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,
|
|
|
-K=La[I].vertices[B.d].position,P=Da[I],P[pa]=U.x,P[pa+1]=U.y,P[pa+2]=U.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ha.x,P[pa+7]=ha.y,P[pa+8]=ha.z,P[pa+9]=K.x,P[pa+10]=K.y,P[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],X=Ma[B.d],fa[T]=I.x,fa[T+1]=I.y,fa[T+2]=I.z,fa[T+3]=I.w,fa[T+4]=C.x,fa[T+5]=C.y,fa[T+6]=C.z,fa[T+7]=C.w,fa[T+8]=P.x,fa[T+9]=P.y,fa[T+10]=P.z,fa[T+11]=P.w,fa[T+12]=X.x,fa[T+13]=X.y,fa[T+14]=X.z,fa[T+15]=X.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],X=Ua[B.d],ea[T]=I.x,ea[T+1]=I.y,
|
|
|
-ea[T+2]=I.z,ea[T+3]=I.w,ea[T+4]=C.x,ea[T+5]=C.y,ea[T+6]=C.z,ea[T+7]=C.w,ea[T+8]=P.x,ea[T+9]=P.y,ea[T+10]=P.z,ea[T+11]=P.w,ea[T+12]=X.x,ea[T+13]=X.y,ea[T+14]=X.z,ea[T+15]=X.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],X=Sa[B.d],aa[T]=I.x,aa[T+1]=I.y,aa[T+2]=I.z,aa[T+3]=1,aa[T+4]=C.x,aa[T+5]=C.y,aa[T+6]=C.z,aa[T+7]=1,aa[T+8]=P.x,aa[T+9]=P.y,aa[T+10]=P.z,aa[T+11]=1,aa[T+12]=X.x,aa[T+13]=X.y,aa[T+14]=X.z,aa[T+15]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],B=Ta[B.d],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,Z[T+3]=1,Z[T+4]=C.x,Z[T+5]=C.y,
|
|
|
-Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,Z[T+12]=B.x,Z[T+13]=B.y,Z[T+14]=B.z,Z[T+15]=1,T+=16;if(Ca&&L)H.length==4&&L==THREE.VertexColors?(B=H[0],I=H[1],C=H[2],H=H[3]):H=C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,ca[V+9]=H.r,ca[V+10]=H.g,ca[V+11]=H.b,V+=12;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[Q]=H.x,ia[Q+1]=H.y,ia[Q+2]=H.z,ia[Q+3]=H.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,
|
|
|
-ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,ia[Q+12]=ja.x,ia[Q+13]=ja.y,ia[Q+14]=ja.z,ia[Q+15]=ja.w,Q+=16;if(Ga&&z)if(F.length==4&&Ia)for(ja=0;ja<4;ja++)na=F[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<4;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<4;ja++)F=x[ja],xa[$]=F.u,xa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)F=A[ja],wa[da]=F.u,wa[da+1]=F.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+3,ma[qa+3]=S+1,ma[qa+4]=S+2,ma[qa+
|
|
|
-5]=S+3,qa+=6,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+3,ra[ya+4]=S+1,ra[ya+5]=S+2,ra[ya+6]=S+2,ra[ya+7]=S+3,ya+=8,S+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(R in ka)C=ka[R],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,u.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-u.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,xa,y));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer),
|
|
|
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
-fa,y));M&&(delete u.__inittedArrays,delete u.__colorArray,delete u.__normalArray,delete u.__tangentArray,delete u.__uvArray,delete u.__uv2Array,delete u.__faceArray,delete u.__vertexArray,delete u.__lineArray,delete u.__skinVertexAArray,delete u.__skinVertexBArray,delete u.__skinIndexArray,delete u.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
|
|
|
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,u=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],u=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||u)if(u=m,y=o.DYNAMIC_DRAW,M=!h.dynamic,u.__inittedArrays){var F=t=w=void 0,B=void 0,na=F=void 0,H=void 0,ua=void 0,ja=void 0,J=T=A=x=z=L=v=void 0,ga=void 0,K=void 0,
|
|
|
+I=B=ja=B=ua=H=void 0,C=void 0,P=C=I=H=void 0,Y=void 0,Q=P=C=I=F=F=na=ja=B=P=C=I=Y=P=C=I=Y=P=C=I=void 0,R=0,oa=0,$=0,ca=0,qa=0,V=0,U=0,ya=0,W=0,S=0,pa=0,P=I=0,P=void 0,fa=u.__vertexArray,xa=u.__uvArray,wa=u.__uv2Array,ha=u.__normalArray,ia=u.__tangentArray,ka=u.__colorArray,Z=u.__skinVertexAArray,aa=u.__skinVertexBArray,da=u.__skinIndexArray,ea=u.__skinWeightArray,Da=u.__morphTargetsArrays,la=u.__webglCustomAttributes,C=void 0,ma=u.__faceArray,ra=u.__lineArray,Ia=u.__needsSmoothNormals,L=u.__vertexColorType,
|
|
|
+v=u.__uvType,z=u.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=u.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(la)for(Q in la)la[Q].offset=0,la[Q].offsetSrc=0;w=0;for(t=cb.length;w<t;w++)if(F=cb[w],B=fb[F],db&&(x=db[F]),eb&&(A=eb[F]),F=
|
|
|
+B.vertexNormals,na=B.normal,H=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,ga=Ja[B.c].position,fa[oa]=T.x,fa[oa+1]=T.y,fa[oa+2]=T.z,fa[oa+3]=J.x,fa[oa+4]=J.y,fa[oa+5]=J.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,oa+=9;if(la)for(Q in la)if(C=la[Q],C.__original.needsUpdate)I=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
|
|
|
+C.boundTo==="faces"?(P=C.value[P],C.array[I]=P,C.array[I+1]=P,C.array[I+2]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ga=C.value[B.c]):C.boundTo==="faces"?(ga=J=T=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[P],J=C.value[P+1],ga=C.value[P+2],C.offsetSrc+=3),C.size===2?(C.array[I]=T.x,C.array[I+1]=
|
|
|
+T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ga.x,C.array[I+5]=ga.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ga.r,C.array[I+7]=ga.g,C.array[I+8]=ga.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ga.x,C.array[I+7]=ga.y,C.array[I+8]=ga.z),C.offset+=9):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,
|
|
|
+C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ga.x,C.array[I+9]=ga.y,C.array[I+10]=ga.z,C.array[I+11]=ga.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ga=La[I].vertices[B.c].position,P=Da[I],P[pa]=T.x,P[pa+1]=T.y,P[pa+2]=T.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ga.x,P[pa+7]=ga.y,P[pa+8]=ga.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],ea[S]=I.x,ea[S+1]=I.y,ea[S+2]=I.z,ea[S+3]=I.w,ea[S+
|
|
|
+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=P.x,ea[S+9]=P.y,ea[S+10]=P.z,ea[S+11]=P.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],da[S]=I.x,da[S+1]=I.y,da[S+2]=I.z,da[S+3]=I.w,da[S+4]=C.x,da[S+5]=C.y,da[S+6]=C.z,da[S+7]=C.w,da[S+8]=P.x,da[S+9]=P.y,da[S+10]=P.z,da[S+11]=P.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=1,Z[S+4]=C.x,Z[S+5]=C.y,Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=P.x,Z[S+9]=P.y,Z[S+10]=P.z,Z[S+11]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+
|
|
|
+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=P.x,aa[S+9]=P.y,aa[S+10]=P.z,aa[S+11]=1,S+=12;if(Ca&&L)H.length==3&&L==THREE.VertexColors?(B=H[0],I=H[1],C=H[2]):C=I=B=ua,ka[W]=B.r,ka[W+1]=B.g,ka[W+2]=B.b,ka[W+3]=I.r,ka[W+4]=I.g,ka[W+5]=I.b,ka[W+6]=C.r,ka[W+7]=C.g,ka[W+8]=C.b,W+=9;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ia[U]=H.x,ia[U+1]=H.y,ia[U+2]=H.z,ia[U+3]=H.w,ia[U+4]=ua.x,ia[U+5]=ua.y,ia[U+6]=ua.z,ia[U+7]=ua.w,ia[U+8]=B.x,ia[U+9]=B.y,ia[U+10]=B.z,ia[U+11]=B.w,U+=12;if(Ga&&z)if(F.length==
|
|
|
+3&&Ia)for(ja=0;ja<3;ja++)na=F[ja],ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;else for(ja=0;ja<3;ja++)ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<3;ja++)F=x[ja],xa[$]=F.u,xa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)F=A[ja],wa[ca]=F.u,wa[ca+1]=F.v,ca+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+2,qa+=3,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+2,ra[ya+4]=R+1,ra[ya+5]=R+2,ya+=6,R+=3)}else if(B instanceof THREE.Face4){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
+ga=Ja[B.c].position,K=Ja[B.d].position,fa[oa]=T.x,fa[oa+1]=T.y,fa[oa+2]=T.z,fa[oa+3]=J.x,fa[oa+4]=J.y,fa[oa+5]=J.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,fa[oa+9]=K.x,fa[oa+10]=K.y,fa[oa+11]=K.z,oa+=12;if(la)for(Q in la)if(C=la[Q],C.__original.needsUpdate)I=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(P=C.value[P],C.array[I]=P,C.array[I+1]=
|
|
|
+P,C.array[I+2]=P,C.array[I+3]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.array[I+3]=C.value[P+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ga=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ga=J=T=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[P],J=C.value[P+1],ga=C.value[P+2],K=C.value[P+3],C.offsetSrc+=4),C.size===2?(C.array[I]=T.x,
|
|
|
+C.array[I+1]=T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ga.x,C.array[I+5]=ga.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ga.r,C.array[I+7]=ga.g,C.array[I+8]=ga.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ga.x,C.array[I+7]=ga.y,
|
|
|
+C.array[I+8]=ga.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ga.x,C.array[I+9]=ga.y,C.array[I+10]=ga.z,C.array[I+11]=ga.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ga=La[I].vertices[B.c].position,
|
|
|
+K=La[I].vertices[B.d].position,P=Da[I],P[pa]=T.x,P[pa+1]=T.y,P[pa+2]=T.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ga.x,P[pa+7]=ga.y,P[pa+8]=ga.z,P[pa+9]=K.x,P[pa+10]=K.y,P[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],Y=Ma[B.d],ea[S]=I.x,ea[S+1]=I.y,ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=P.x,ea[S+9]=P.y,ea[S+10]=P.z,ea[S+11]=P.w,ea[S+12]=Y.x,ea[S+13]=Y.y,ea[S+14]=Y.z,ea[S+15]=Y.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],Y=Ua[B.d],da[S]=I.x,da[S+1]=I.y,
|
|
|
+da[S+2]=I.z,da[S+3]=I.w,da[S+4]=C.x,da[S+5]=C.y,da[S+6]=C.z,da[S+7]=C.w,da[S+8]=P.x,da[S+9]=P.y,da[S+10]=P.z,da[S+11]=P.w,da[S+12]=Y.x,da[S+13]=Y.y,da[S+14]=Y.z,da[S+15]=Y.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],Y=Sa[B.d],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=1,Z[S+4]=C.x,Z[S+5]=C.y,Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=P.x,Z[S+9]=P.y,Z[S+10]=P.z,Z[S+11]=1,Z[S+12]=Y.x,Z[S+13]=Y.y,Z[S+14]=Y.z,Z[S+15]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],B=Ta[B.d],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=
|
|
|
+C.z,aa[S+7]=1,aa[S+8]=P.x,aa[S+9]=P.y,aa[S+10]=P.z,aa[S+11]=1,aa[S+12]=B.x,aa[S+13]=B.y,aa[S+14]=B.z,aa[S+15]=1,S+=16;if(Ca&&L)H.length==4&&L==THREE.VertexColors?(B=H[0],I=H[1],C=H[2],H=H[3]):H=C=I=B=ua,ka[W]=B.r,ka[W+1]=B.g,ka[W+2]=B.b,ka[W+3]=I.r,ka[W+4]=I.g,ka[W+5]=I.b,ka[W+6]=C.r,ka[W+7]=C.g,ka[W+8]=C.b,ka[W+9]=H.r,ka[W+10]=H.g,ka[W+11]=H.b,W+=12;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[U]=H.x,ia[U+1]=H.y,ia[U+2]=H.z,ia[U+3]=H.w,ia[U+4]=ua.x,ia[U+5]=ua.y,ia[U+6]=ua.z,ia[U+7]=
|
|
|
+ua.w,ia[U+8]=B.x,ia[U+9]=B.y,ia[U+10]=B.z,ia[U+11]=B.w,ia[U+12]=ja.x,ia[U+13]=ja.y,ia[U+14]=ja.z,ia[U+15]=ja.w,U+=16;if(Ga&&z)if(F.length==4&&Ia)for(ja=0;ja<4;ja++)na=F[ja],ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;else for(ja=0;ja<4;ja++)ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<4;ja++)F=x[ja],xa[$]=F.u,xa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)F=A[ja],wa[ca]=F.u,wa[ca+1]=F.v,ca+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+3,ma[qa+3]=R+1,ma[qa+4]=R+2,ma[qa+
|
|
|
+5]=R+3,qa+=6,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+3,ra[ya+4]=R+1,ra[ya+5]=R+2,ra[ya+6]=R+2,ra[ya+7]=R+3,ya+=8,R+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));if(la)for(Q in la)C=la[Q],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,u.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+u.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ka,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,xa,y));Aa&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer),
|
|
|
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
+ea,y));M&&(delete u.__inittedArrays,delete u.__colorArray,delete u.__normalArray,delete u.__tangentArray,delete u.__uvArray,delete u.__uv2Array,delete u.__faceArray,delete u.__vertexArray,delete u.__lineArray,delete u.__skinVertexAArray,delete u.__skinVertexBArray,delete u.__skinIndexArray,delete u.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
|
|
|
k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=M=M=void 0;t=k.vertices;p=k.colors;v=t.length;u=p.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<u;M++)color=p[M],n=M*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=M=M=void 0;t=k.vertices;p=k.colors;v=t.length;u=p.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<u;M++)color=p[M],n=M*3,y[n]=color.r,y[n+1]=color.g,
|
|
|
y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,u=E(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||u)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
|
|
@@ -474,8 +474,8 @@ this.maxDistance&&this.position.setLength(this.maxDistance),h.lengthSq()<this.mi
|
|
|
!1);this.domElement.addEventListener("mousemove",c(this,function(b){e&&(k=m=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=t=this.getMouseOnScreen(b.clientX,b.clientY),v=w=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?m=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(w=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",
|
|
|
c(this,function(b){b.preventDefault();b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?k=m=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=t=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(v=w=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===
|
|
|
this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,t){function v(b,e,c,m,n,p,u,t){var v,x,y=f||1,A=h||1,R=n/2,S=p/2,Y=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",y=k||1;var W=y+1,o=A+1;n/=y;var ea=p/A;for(x=0;x<o;x++)for(p=0;p<W;p++){var Q=new THREE.Vector3;Q[b]=(p*n-R)*c;Q[e]=(x*ea-S)*m;Q[v]=u;w.vertices.push(new THREE.Vertex(Q))}for(x=0;x<A;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+W*
|
|
|
-x+Y,p+W*(x+1)+Y,p+1+W*(x+1)+Y,p+1+W*x+Y,null,null,t)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/A),new THREE.UV(p/y,(x+1)/A),new THREE.UV((p+1)/y,(x+1)/A),new THREE.UV((p+1)/y,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,p=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var A in t)this.sides[A]!=void 0&&(this.sides[A]=
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,t){function v(b,e,c,m,n,p,u,t){var v,x,y=f||1,A=h||1,Q=n/2,R=p/2,U=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",y=k||1;var X=y+1,o=A+1;n/=y;var da=p/A;for(x=0;x<o;x++)for(p=0;p<X;p++){var V=new THREE.Vector3;V[b]=(p*n-Q)*c;V[e]=(x*da-R)*m;V[v]=u;w.vertices.push(new THREE.Vertex(V))}for(x=0;x<A;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+X*
|
|
|
+x+U,p+X*(x+1)+U,p+1+X*(x+1)+U,p+1+X*x+U,null,null,t)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/A),new THREE.UV(p/y,(x+1)/A),new THREE.UV((p+1)/y,(x+1)/A),new THREE.UV((p+1)/y,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,p=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var A in t)this.sides[A]!=void 0&&(this.sides[A]=
|
|
|
t[A]);this.sides.px&&v("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&v("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&v("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&v("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&v("x","y",1*n,-1,b,c,p,this.materials[4]);this.sides.nz&&v("x","y",-1*n,-1,b,c,-p,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,t,v=[],w=[];for(t=0;t<=h;t++){var u=[],x=[],p=t/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var A=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(A*Math.PI*2),-p*e+m,y*Math.cos(A*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(A,p))}v.push(u);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=v[t][n],u=v[t+1][n],x=v[t+1][n+1],p=v[t][n+1],y=
|
|
@@ -484,13 +484,13 @@ this.vertices[e].position.clone().setY(0).normalize(),A=this.vertices[u].positio
|
|
|
G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,A,z])),this.faceVertexUvs[0].push([E,D,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
|
|
|
-n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ka=J;fa=J-1;fa<0&&(fa=b.length-
|
|
|
-1);for(var e=0,c=p+w*2,e=0;e<c;e++){var f=ea*e,h=ea*(e+1),k=ca+ka+f,m=ca+ka+h,o=k,f=ca+fa+f,h=ca+fa+h,u=m;o+=da;f+=da;h+=da;u+=da;B.faces.push(new THREE.Face4(o,f,h,u,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+t*2,k=(B.vertices[k].position.z+t)/h,m=(B.vertices[m].position.z+t)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;B.faces.push(new THREE.Face3(b,
|
|
|
+n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ma=J;ea=J-1;ea<0&&(ea=b.length-
|
|
|
+1);for(var e=0,c=p+w*2,e=0;e<c;e++){var f=da*e,h=da*(e+1),k=Z+ma+f,m=Z+ma+h,o=k,f=Z+ea+f,h=Z+ea+h,u=m;o+=ca;f+=ca;h+=ca;u+=ca;B.faces.push(new THREE.Face4(o,f,h,u,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+t*2,k=(B.vertices[k].position.z+t)/h,m=(B.vertices[m].position.z+t)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=ca;e+=ca;c+=ca;B.faces.push(new THREE.Face3(b,
|
|
|
e,c,null,null,D));if(D){var f=N.maxY,h=N.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,v=c.bevelSize!==void 0?c.bevelSize:t-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,y=c.bendPath,A=c.extrudePath,z,F=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,N=this.shapebb;if(A)z=A.getPoints(x),p=z.length,F=!0,u=!1;u||(v=t=w=0);var O,K,H,B=this,da=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(A=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(H=x.length;K<H;K++)O=x[K],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
-(x[K]=O.reverse());A=!1}A=THREE.Shape.Utils.triangulateShape(y,x);E=y;K=0;for(H=x.length;K<H;K++)O=x[K],y=y.concat(O);var J,R,S,Y,W,o,ea=y.length,Q=A.length,ma=[];J=0;R=E.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ma[J]=f(E[J],E[ka],E[fa]);var Z=[],ia,aa=ma.concat();K=0;for(H=x.length;K<H;K++){O=x[K];ia=[];J=0;R=O.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ia[J]=f(O[J],O[ka],O[fa]);Z.push(ia);aa=aa.concat(ia)}for(S=0;S<w;S++){Y=S/w;W=t*(1-Y);
|
|
|
-Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=E.length;J<R;J++)o=e(E[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(H=x.length;K<H;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),k(o.x,o.y,-W)}}Y=v;for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],F?k(o.x,o.y+z[0].y,z[0].x):k(o.x,o.y,0);for(S=1;S<=p;S++)for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],F?k(o.x,o.y+z[S-1].y,z[S-1].x):k(o.x,o.y,n/p*S);for(S=w-1;S>=0;S--){Y=S/w;W=t*(1-Y);Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=E.length;J<R;J++)o=e(E[J],ma[J],Y),k(o.x,o.y,n+W);
|
|
|
-K=0;for(H=x.length;K<H;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),F?k(o.x,o.y+z[p-1].y,z[p-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(J=0;J<Q;J++)v=A[J],m(v[2]+u,v[1]+u,v[0]+u);u=ea*(p+w*2);for(J=0;J<Q;J++)v=A[J],m(v[0]+u,v[1]+u,v[2]+u)}else{for(J=0;J<Q;J++)v=A[J],m(v[2],v[1],v[0]);for(J=0;J<Q;J++)v=A[J],m(v[0]+ea*p,v[1]+ea*p,v[2]+ea*p)}var ka,fa,ca=0;h(E);ca+=E.length;K=0;for(H=x.length;K<H;K++)O=x[K],h(O),ca+=O.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,y=c.bendPath,A=c.extrudePath,z,F=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,N=this.shapebb;if(A)z=A.getPoints(x),p=z.length,F=!0,u=!1;u||(v=t=w=0);var O,K,H,B=this,ca=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(A=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(H=x.length;K<H;K++)O=x[K],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
+(x[K]=O.reverse());A=!1}A=THREE.Shape.Utils.triangulateShape(y,x);E=y;K=0;for(H=x.length;K<H;K++)O=x[K],y=y.concat(O);var J,Q,R,U,X,o,da=y.length,V=A.length,la=[];J=0;Q=E.length;ma=Q-1;for(ea=J+1;J<Q;J++,ma++,ea++)ma==Q&&(ma=0),ea==Q&&(ea=0),la[J]=f(E[J],E[ma],E[ea]);var ha=[],ka,aa=la.concat();K=0;for(H=x.length;K<H;K++){O=x[K];ka=[];J=0;Q=O.length;ma=Q-1;for(ea=J+1;J<Q;J++,ma++,ea++)ma==Q&&(ma=0),ea==Q&&(ea=0),ka[J]=f(O[J],O[ma],O[ea]);ha.push(ka);aa=aa.concat(ka)}for(R=0;R<w;R++){U=R/w;X=t*(1-
|
|
|
+U);U=v*Math.sin(U*Math.PI/2);J=0;for(Q=E.length;J<Q;J++)o=e(E[J],la[J],U),k(o.x,o.y,-X);K=0;for(H=x.length;K<H;K++){O=x[K];ka=ha[K];J=0;for(Q=O.length;J<Q;J++)o=e(O[J],ka[J],U),k(o.x,o.y,-X)}}U=v;for(J=0;J<da;J++)o=u?e(y[J],aa[J],U):y[J],F?k(o.x,o.y+z[0].y,z[0].x):k(o.x,o.y,0);for(R=1;R<=p;R++)for(J=0;J<da;J++)o=u?e(y[J],aa[J],U):y[J],F?k(o.x,o.y+z[R-1].y,z[R-1].x):k(o.x,o.y,n/p*R);for(R=w-1;R>=0;R--){U=R/w;X=t*(1-U);U=v*Math.sin(U*Math.PI/2);J=0;for(Q=E.length;J<Q;J++)o=e(E[J],la[J],U),k(o.x,o.y,
|
|
|
+n+X);K=0;for(H=x.length;K<H;K++){O=x[K];ka=ha[K];J=0;for(Q=O.length;J<Q;J++)o=e(O[J],ka[J],U),F?k(o.x,o.y+z[p-1].y,z[p-1].x+X):k(o.x,o.y,n+X)}}if(u){u=da*0;for(J=0;J<V;J++)v=A[J],m(v[2]+u,v[1]+u,v[0]+u);u=da*(p+w*2);for(J=0;J<V;J++)v=A[J],m(v[0]+u,v[1]+u,v[2]+u)}else{for(J=0;J<V;J++)v=A[J],m(v[2],v[1],v[0]);for(J=0;J<V;J++)v=A[J],m(v[0]+da*p,v[1]+da*p,v[2]+da*p)}var ma,ea,Z=0;h(E);Z+=E.length;K=0;for(H=x.length;K<H;K++)O=x[K],h(O),Z+=O.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(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var t=f(k.faces[n].a,k.faces[n].b),v=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,t,w,b);e(k.faces[n].b,v,
|
|
@@ -514,7 +514,7 @@ this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[
|
|
|
v));h.moveTo(n,v);break;case "l":n=c[b++]*e+f;v=c[b++]*e;k.push(new THREE.Vector2(n,v));h.lineTo(n,v);break;case "q":n=c[b++]*e+f;v=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,v);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var F=m/divisions,E=THREE.Shape.Utils.b2(F,w,x,n),F=THREE.Shape.Utils.b2(F,u,p,v);k.push(new THREE.Vector2(E,F))}}break;case "b":if(n=c[b++]*e+f,v=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(n,v,
|
|
|
x,p,y,A),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)F=m/divisions,E=THREE.Shape.Utils.b3(F,w,x,y,n),F=THREE.Shape.Utils.b3(F,u,p,A,v),k.push(new THREE.Vector2(E,F))}}}return{offset:z.ha*e,points:k,path:h}}}};
|
|
|
(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],t,v,w;if(c(b)>0)for(v=0;v<h;v++)m[v]=v;else for(v=0;v<h;v++)m[v]=h-1-v;var u=2*h;for(v=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=v;h<=t&&(t=0);v=t+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=v,A=w,z=h,F=m,E=void 0,D=void 0,G=void 0,
|
|
|
-N=void 0,O=void 0,K=void 0,H=void 0,B=void 0,da=void 0,D=x[F[p]].x,G=x[F[p]].y,N=x[F[y]].x,O=x[F[y]].y,K=x[F[A]].x,H=x[F[A]].y;if(1.0E-10>(N-D)*(H-G)-(O-G)*(K-D))x=!1;else{for(E=0;E<z;E++)if(!(E==p||E==y||E==A)){var B=x[F[E]].x,da=x[F[E]].y,J=void 0,R=void 0,S=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,Q=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=S=W=void 0,J=K-N,R=H-O,S=D-K,Y=G-H,W=N-D,o=O-G,ea=B-D,Q=da-G,ma=B-N,Z=da-O,ia=B-K,aa=da-H,J=J*Z-R*ma,W=W*Q-o*ea,S=S*aa-Y*ia;if(J>=0&&S>=0&&W>=0){x=
|
|
|
+N=void 0,O=void 0,K=void 0,H=void 0,B=void 0,ca=void 0,D=x[F[p]].x,G=x[F[p]].y,N=x[F[y]].x,O=x[F[y]].y,K=x[F[A]].x,H=x[F[A]].y;if(1.0E-10>(N-D)*(H-G)-(O-G)*(K-D))x=!1;else{for(E=0;E<z;E++)if(!(E==p||E==y||E==A)){var B=x[F[E]].x,ca=x[F[E]].y,J=void 0,Q=void 0,R=void 0,U=void 0,X=void 0,o=void 0,da=void 0,V=void 0,la=void 0,ha=void 0,ka=void 0,aa=void 0,J=R=X=void 0,J=K-N,Q=H-O,R=D-K,U=G-H,X=N-D,o=O-G,da=B-D,V=ca-G,la=B-N,ha=ca-O,ka=B-K,aa=ca-H,J=J*ha-Q*la,X=X*V-o*da,R=R*aa-U*ka;if(J>=0&&R>=0&&X>=0){x=
|
|
|
!1;break a}}x=!0}}if(x){k.push([b[m[t]],b[m[v]],b[m[w]]]);n.push([m[t],m[v],m[w]]);t=v;for(w=v+1;w<h;t++,w++)m[t]=m[w];h--;u=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
|
|
|
this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,t=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[k]);t.normal.addSelf(c[m]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
|
|
@@ -523,13 +523,13 @@ THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,h,k){e=c/f*b;
|
|
|
this.segmentsT;++c){var t=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(t,m,this.q,this.p,this.radius,this.heightScale),t=n(t+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=t.x-h.x;e.y=t.y-h.y;e.z=t.z-h.z;f.x=t.x+h.x;f.y=t.y+h.y;f.z=t.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();t=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=t*f.x+m*k.x;h.y+=t*f.y+m*k.y;h.z+=t*f.z+m*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
|
|
|
h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),v=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,t,v,w])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c-- >0;)this.smooth(b)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)p.vertexColors=n.vertexColors;h.push(p);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,t=n.concat(),v=[],w={},u=[],x,p,y,A,z,F=b.faceVertexUvs[0];x=0;for(p=F.length;x<p;x++){y=0;for(A=F[x].length;y<A;y++)z=f[x]["abcd".charAt(y)],
|
|
|
-u[z]||(u[z]=F[x][y])}var E;x=0;for(p=f.length;x<p;x++)if(z=f[x],v.push(z.centroid),t.push(new THREE.Vertex(z.centroid)),m.supportUVs&&u.length!=0){E=new THREE.UV;if(z instanceof THREE.Face3)E.u=u[z.a].u+u[z.b].u+u[z.c].u,E.v=u[z.a].v+u[z.b].v+u[z.c].v,E.u/=3,E.v/=3;else if(z instanceof THREE.Face4)E.u=u[z.a].u+u[z.b].u+u[z.c].u+u[z.d].u,E.v=u[z.a].v+u[z.b].v+u[z.c].v+u[z.d].v,E.u/=4,E.v/=4;u.push(E)}A=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<
|
|
|
-h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,G,N=0,F=n.length,O;for(x in A)if(z=A[x],E=z[0],D=z[1],O=x.split("_"),p=O[0],O=O[1],G=new THREE.Vector3,z.length!=2?(G.addSelf(n[p].position),G.addSelf(n[O].position),G.multiplyScalar(0.5)):(G.addSelf(v[E]),G.addSelf(v[D]),G.addSelf(n[p].position),G.addSelf(n[O].position),
|
|
|
-G.multiplyScalar(0.25)),w[x]=F+f.length+N,t.push(new THREE.Vertex(G)),N++,m.supportUVs&&u.length!=0)E=new THREE.UV,E.u=u[p].u+u[O].u,E.v=u[p].v+u[O].v,E.u/=2,E.v/=2,u.push(E);x=0;for(p=v.length;x<p;x++)z=f[x],E=F+x,z instanceof THREE.Face3?(D=e(z.a,z.b),O=e(z.b,z.c),N=e(z.c,z.a),c(E,w[D],z.b,w[O],z),c(E,w[O],z.c,w[N],z),c(E,w[N],z.a,w[D],z)):z instanceof THREE.Face4?(D=e(z.a,z.b),O=e(z.b,z.c),N=e(z.c,z.d),G=e(z.d,z.a),c(E,w[D],z.b,w[O],z),c(E,w[O],z.c,w[N],z),c(E,w[N],z.d,w[G],z),c(E,w[G],z.a,w[D],
|
|
|
-z)):console.log("face should be a face!",z);var f=t,K={},H={},t=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,e){H[b]===void 0&&(H[b]={});H[b][e]=null};for(x in A)z=A[x],O=x.split("_"),p=O[0],O=O[1],t(p,[p,O]),t(O,[p,O]),E=z[0],D=z[1],w(p,E),D?w(p,D):w(p,E),w(O,E),D?w(O,D):w(O,E);t=new THREE.Vector3;w=new THREE.Vector3;x=0;for(p=n.length;x<p;x++)if(K[x]!==void 0){t.set(0,0,0);w.set(0,0,0);A=new THREE.Vector3(0,0,0);F=0;for(y in H[x])t.addSelf(v[y]),F++;t.divideScalar(F);F=K[x].length;
|
|
|
-for(y=0;y<F;y++)z=K[x][y],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),w.addSelf(z);w.divideScalar(F);A.addSelf(n[x].position);A.multiplyScalar(F-3);A.addSelf(t);A.addSelf(w.multiplyScalar(2));A.divideScalar(F);f[x].position=A}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};
|
|
|
-THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n,p){var t=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){t.vertexColors=[];for(var o,v,w,x=0;x<4;x++){w=p[x];o=new THREE.Color;o.setRGB(0,0,0);for(var y=0;y<w.length;y++)v=n.vertexColors[w[y]-1],o.r+=v.r,o.g+=v.g,o.b+=v.b;o.r/=w.length;o.g/=w.length;o.b/=w.length;t.vertexColors[x]=o}}h.push(t);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,
|
|
|
+e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,t=n.concat(),v=[],w={},u=[],x,p,y,A,z,F=b.faceVertexUvs[0];x=0;for(p=F.length;x<p;x++){y=0;for(A=F[x].length;y<A;y++)z=f[x]["abcd".charAt(y)],u[z]||(u[z]=F[x][y])}var E;x=0;for(p=f.length;x<p;x++)if(z=f[x],v.push(z.centroid),t.push(new THREE.Vertex(z.centroid)),m.supportUVs&&u.length!=0){E=new THREE.UV;if(z instanceof THREE.Face3)E.u=u[z.a].u+u[z.b].u+u[z.c].u,E.v=u[z.a].v+u[z.b].v+u[z.c].v,E.u/=3,E.v/=3;else if(z instanceof THREE.Face4)E.u=u[z.a].u+
|
|
|
+u[z.b].u+u[z.c].u+u[z.d].u,E.v=u[z.a].v+u[z.b].v+u[z.c].v+u[z.d].v,E.u/=4,E.v/=4;u.push(E)}A=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,G,N=0,F=n.length,O;for(x in A)if(z=A[x],E=z[0],D=
|
|
|
+z[1],O=x.split("_"),p=O[0],O=O[1],G=new THREE.Vector3,z.length!=2?(G.addSelf(n[p].position),G.addSelf(n[O].position),G.multiplyScalar(0.5)):(G.addSelf(v[E]),G.addSelf(v[D]),G.addSelf(n[p].position),G.addSelf(n[O].position),G.multiplyScalar(0.25)),w[x]=F+f.length+N,t.push(new THREE.Vertex(G)),N++,m.supportUVs&&u.length!=0)E=new THREE.UV,E.u=u[p].u+u[O].u,E.v=u[p].v+u[O].v,E.u/=2,E.v/=2,u.push(E);x=0;for(p=v.length;x<p;x++)z=f[x],E=F+x,z instanceof THREE.Face3?(D=e(z.a,z.b),O=e(z.b,z.c),N=e(z.c,z.a),
|
|
|
+c(E,w[D],z.b,w[O],z,["123","12","2","23"]),c(E,w[O],z.c,w[N],z,["123","23","3","31"]),c(E,w[N],z.a,w[D],z,["123","31","1","12"])):z instanceof THREE.Face4?(D=e(z.a,z.b),O=e(z.b,z.c),N=e(z.c,z.d),G=e(z.d,z.a),c(E,w[D],z.b,w[O],z,["1234","12","2","23"]),c(E,w[O],z.c,w[N],z,["1234","13","3","34"]),c(E,w[N],z.d,w[G],z,["1234","34","4","41"]),c(E,w[G],z.a,w[D],z,["1234","41","1","12"])):console.log("face should be a face!",z);var f=t,K={},H={},t=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,
|
|
|
+e){H[b]===void 0&&(H[b]={});H[b][e]=null};for(x in A)z=A[x],O=x.split("_"),p=O[0],O=O[1],t(p,[p,O]),t(O,[p,O]),E=z[0],D=z[1],w(p,E),D?w(p,D):w(p,E),w(O,E),D?w(O,D):w(O,E);t=new THREE.Vector3;w=new THREE.Vector3;x=0;for(p=n.length;x<p;x++)if(K[x]!==void 0){t.set(0,0,0);w.set(0,0,0);A=new THREE.Vector3(0,0,0);F=0;for(y in H[x])t.addSelf(v[y]),F++;t.divideScalar(F);F=K[x].length;for(y=0;y<F;y++)z=K[x][y],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),w.addSelf(z);w.divideScalar(F);
|
|
|
+A.addSelf(n[x].position);A.multiplyScalar(F-3);A.addSelf(t);A.addSelf(w.multiplyScalar(2));A.divideScalar(F);f[x].position=A}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
|
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?".":b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
|
|
|
b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,h,m,n){var t=document.createElement("canvas");b[e]=new THREE.Texture(t);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
|
|
@@ -544,19 +544,19 @@ c.postMessage(b)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,t=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(t==0&&(t=m.getResponseHeader("Content-Length")),k({total:t,loaded:m.responseText.length})):m.readyState==2&&(t=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
m.setRequestHeader("Content-Type","text/plain");m.send(null)};
|
|
|
THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function v(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
|
|
|
-f,k;c=h(b,e);f=h(b,e+O);k=h(b,e+K);e=t(b,e+H);F.faces.push(new THREE.Face3(c,f,k,null,null,F.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+O);k=h(b,e+K);m=t(b,e+H);o=h(b,e+B);p=h(b,e+da);e=h(b,e+J);m=F.materials[m];var u=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,x,e)],null,m))}function p(e){var c,f,k,m;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,
|
|
|
-e+Y);e=t(b,e+W);F.faces.push(new THREE.Face4(c,f,k,m,null,null,F.materials[e]))}function y(e){var c,f,k,m,p,u,v,w;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,e+Y);p=t(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+Q);e=h(b,e+ma);p=F.materials[p];var x=G[v*3],L=G[v*3+1];v=G[v*3+2];var y=G[w*3],M=G[w*3+1];w=G[w*3+2];var z=G[e*3],A=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,M,w),new THREE.Vector3(z,A,e)],null,p))}
|
|
|
-function A(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=N[c*2];m=N[c*2+1];c=N[f*2];var o=F.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function z(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=N[c*2];o=N[c*2+1];c=N[f*2];p=N[f*2+1];f=N[k*2];var t=F.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
|
|
|
-k));v.push(new THREE.UV(u,m));t.push(v)}var F=this,E=0,D,G=[],N=[],O,K,H,B,da,J,R,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
|
|
|
-E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;O=D.vertex_index_bytes;K=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;R=D.vertex_index_bytes;
|
|
|
-S=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;Q=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;aa=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
|
|
|
-4+D.material_index_bytes;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);X=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);E+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
-h,k)));return D.nvertices*n}(E);E+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=v(b,e),f=v(b,e+D.normal_coordinate_bytes),h=v(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(E);E+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),N.push(f,h);return D.nuvs*k}(E);ca=E+ca;$=ca+$;X=$+X;ga=X+ga;la=ga+la;e=la+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
-f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),A(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),A(e+c);return h-b})(X);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)p(e),z(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
|
|
|
-4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),z(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(E);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(ca);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)p(e);return f-b})(ga);(function(b){var e,
|
|
|
-c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
-THREE.ColladaLoader=function(){function b(b,e,c){for(var b=ca.evaluate(b,ca,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
|
|
|
-new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=P[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=X.getChildById(f.skeleton[0],!0)||X.getChildBySid(f.skeleton[0],
|
|
|
+f,k;c=h(b,e);f=h(b,e+O);k=h(b,e+K);e=t(b,e+H);F.faces.push(new THREE.Face3(c,f,k,null,null,F.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+O);k=h(b,e+K);m=t(b,e+H);o=h(b,e+B);p=h(b,e+ca);e=h(b,e+J);m=F.materials[m];var u=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,x,e)],null,m))}function p(e){var c,f,k,m;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,
|
|
|
+e+U);e=t(b,e+X);F.faces.push(new THREE.Face4(c,f,k,m,null,null,F.materials[e]))}function y(e){var c,f,k,m,p,u,v,w;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,e+U);p=t(b,e+X);u=h(b,e+o);v=h(b,e+da);w=h(b,e+V);e=h(b,e+la);p=F.materials[p];var x=G[v*3],L=G[v*3+1];v=G[v*3+2];var y=G[w*3],M=G[w*3+1];w=G[w*3+2];var z=G[e*3],A=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,M,w),new THREE.Vector3(z,A,e)],null,p))}
|
|
|
+function A(e){var c,f,k,m;c=h(b,e);f=h(b,e+ha);k=h(b,e+ka);e=N[c*2];m=N[c*2+1];c=N[f*2];var o=F.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function z(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ma);m=h(b,e+ea);e=N[c*2];o=N[c*2+1];c=N[f*2];p=N[f*2+1];f=N[k*2];var t=F.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
|
|
|
+k));v.push(new THREE.UV(u,m));t.push(v)}var F=this,E=0,D,G=[],N=[],O,K,H,B,ca,J,Q,R,U,X,o,da,V,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
|
|
|
+E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;O=D.vertex_index_bytes;K=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;ca=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes;
|
|
|
+R=D.vertex_index_bytes*2;U=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;da=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;V=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;la=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ka=D.uv_index_bytes*2;aa=D.uv_index_bytes;ma=D.uv_index_bytes*2;ea=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
|
|
|
+4+D.material_index_bytes;Z=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);Y=D.ntri_flat_uv*(e+D.uv_index_bytes*3);fa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);E+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
+h,k)));return D.nvertices*n}(E);E+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=v(b,e),f=v(b,e+D.normal_coordinate_bytes),h=v(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(E);E+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),N.push(f,h);return D.nuvs*k}(E);Z=E+Z;$=Z+$;Y=$+Y;fa=Y+fa;ia=fa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
+f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),A(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),A(e+c);return h-b})(Y);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)p(e),z(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
|
|
|
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),z(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(E);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Z);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)p(e);return f-b})(fa);(function(b){var e,
|
|
|
+c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);return f-b})(ia);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
+THREE.ColladaLoader=function(){function b(b,e,c){for(var b=Z.evaluate(b,Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
|
|
|
+new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=P[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=Y.getChildById(f.skeleton[0],!0)||Y.getChildBySid(f.skeleton[0],
|
|
|
!0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
|
|
|
for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
|
|
|
c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=P[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(P[n.skin.source]&&(k=n=P[n.skin.source],n.morph&&oa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
|
|
@@ -565,50 +565,50 @@ v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.
|
|
|
else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=oa[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
|
|
|
this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=
|
|
|
this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function z(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
|
|
|
-this.stride=this.count=0;this.params=[]}function G(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function O(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function H(){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 B(b,e){this.type=b;this.effect=e;this.material=null}function da(b){this.effect=b;this.format=this.init_from=
|
|
|
-null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function S(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
|
|
|
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var e=b.getAttribute("id");if(la[e]!=void 0)return la[e];la[e]=(new O(e)).parse(b);return la[e]}function Q(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function Z(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ia(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
-"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ka(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function fa(b,e){var c="";c+=ka(b.x,e)+",";c+=ka(b.y,e)+",";c+=ka(b.z,e);return c}var ca=null,$=null,X,ga=null,la={},ra={},na={},P={},oa={},qa={},wa={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
|
+this.stride=this.count=0;this.params=[]}function G(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function O(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function H(){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 B(b,e){this.type=b;this.effect=e;this.material=null}function ca(b){this.effect=b;this.format=this.init_from=
|
|
|
+null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function R(){this.url=""}function U(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function X(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
|
|
|
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function da(b){var e=b.getAttribute("id");if(ia[e]!=void 0)return ia[e];ia[e]=(new O(e)).parse(b);return ia[e]}function V(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function ha(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
+"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ma(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function ea(b,e){var c="";c+=ma(b.x,e)+",";c+=ma(b.y,e)+",";c+=ma(b.z,e);return c}var Z=null,$=null,Y,fa=null,ia={},ra={},na={},P={},oa={},qa={},wa={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
|
b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(b){var e=
|
|
|
{},c=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new O).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
|
|
|
-function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new N).parse(f))}}return e};t.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
|
+function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new N).parse(f))}}return e};t.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=la(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
|
k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new O).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};t.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new N).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
|
|
|
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};t.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":c=Z(m.textContent);break;case "vcount":f=Z(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
|
|
|
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};t.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":c=ha(m.textContent);break;case "vcount":f=ha(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
|
|
|
case "WEIGHT":t.weight=e[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};v.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};v.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};v.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
|
|
|
this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
|
|
|
""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
|
|
|
b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
|
|
|
-case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",ca,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
|
|
|
+case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
|
|
|
break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in na)for(var h=na[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
|
|
|
1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,t,o=0;o<p.input.length-1;o++)if(p.input[o+1]>e){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
|
|
|
-e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
+e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=la(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
|
|
|
-x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=c.iterateNext()}}return this};
|
|
|
-p.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=ca.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),
|
|
|
-e=b.iterateNext();break}}return this};A.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new z(this)).parse(c)}}return this};z.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
|
|
|
-(new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=la[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
|
|
|
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=c.iterateNext()}}return this};
|
|
|
+p.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),
|
|
|
+e=b.iterateNext();break}}return this};A.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new z(this)).parse(c)}}return this};z.prototype.parse=function(b){function e(b,c){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":da(f);break;case "vertices":this.vertices=
|
|
|
+(new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ia[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
|
|
|
this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
|
|
|
-n[k],source=la[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;v==
|
|
|
+n[k],source=ia[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=ea(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;v==
|
|
|
3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};F.prototype=new E;F.prototype.constructor=F;E.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
|
|
|
-E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
|
|
|
+E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[e]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p=ha(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
|
|
|
0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new N).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
|
|
|
-"");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};O.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ia(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=ma(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-Z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};O.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
|
|
|
-this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new S).parse(b.childNodes[e]);break}return this};H.prototype.isColor=
|
|
|
-function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=ma(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
|
|
|
-b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=ca.evaluate(".//dae:float",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
|
|
|
+"");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};O.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ka(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=la(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ka(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};O.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
|
|
|
+this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new R).parse(b.childNodes[e]);break}return this};H.prototype.isColor=
|
|
|
+function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=la(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
|
|
|
+b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
|
|
|
{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=
|
|
|
-f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};da.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
+f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};ca.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
c.nodeName)}}return this};J.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
|
-R.prototype.create=function(){if(this.shader==null)return null};R.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};R.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
|
|
|
-(new da(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};R.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
|
|
|
-R.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};S.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
|
|
|
-(new O).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new W(this)).parse(c))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
|
|
|
+Q.prototype.create=function(){if(this.shader==null)return null};Q.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Q.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
|
|
|
+(new ca(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};Q.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
|
|
|
+Q.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};R.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};U.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
|
|
|
+(new O).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new X(this)).parse(c))}}return this};X.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
|
|
|
parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new N).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
|
|
|
c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
|
|
|
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){ga=f;var o,p=e;ca=n.responseXML;o=ga;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
|
|
|
-K,"material");wa=b("//dae:library_effects/dae:effect",R,"effect");oa=b("//dae:library_geometries/dae:geometry",A,"geometry");P=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",Y,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",v,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),X=ta[p]):
|
|
|
-X=null;$=new THREE.Object3D;for(p=0;p<X.nodes.length;p++)$.add(h(X.nodes[p]));c();for(var t in na);t={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:wa,geometries:oa,controllers:P,animations:na,visualScenes:ta,scene:X}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
+document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){fa=f;var o,p=e;Z=n.responseXML;o=fa;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
|
|
|
+K,"material");wa=b("//dae:library_effects/dae:effect",Q,"effect");oa=b("//dae:library_geometries/dae:geometry",A,"geometry");P=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",U,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",v,"visual_scene");Aa=[];Ca=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ta[p]):
|
|
|
+Y=null;$=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)$.add(h(Y.nodes[p]));c();for(var t in na);t={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:wa,geometries:oa,controllers:P,animations:na,visualScenes:ta,scene:Y}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,t,v,w,u,x,p,y,A,z,F,E,D,G=b.faces;u=b.vertices;var N=b.normals,O=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];v=0;for(w=u.length;v<w;)x=new THREE.Vertex,x.position.x=u[v++]*e,x.position.y=
|
|
|
u[v++]*e,x.position.z=u[v++]*e,f.vertices.push(x);v=0;for(w=G.length;v<w;){e=G[v++];u=e&1;t=e&2;c=e&4;h=e&8;p=e&16;x=e&32;A=e&64;e&=128;u?(z=new THREE.Face4,z.a=G[v++],z.b=G[v++],z.c=G[v++],z.d=G[v++],u=4):(z=new THREE.Face3,z.a=G[v++],z.b=G[v++],z.c=G[v++],u=3);if(t)t=G[v++],z.materials=f.materials[t];t=f.faces.length;if(c)for(c=0;c<K;c++)F=b.uvs[c],y=G[v++],D=F[y*2],y=F[y*2+1],f.faceUvs[c][t]=new THREE.UV(D,y);if(h)for(c=0;c<K;c++){F=b.uvs[c];E=[];for(h=0;h<u;h++)y=G[v++],D=F[y*2],y=F[y*2+1],E[h]=
|
|
@@ -616,26 +616,26 @@ new THREE.UV(D,y);f.faceVertexUvs[c][t]=E}if(p)p=G[v++]*3,h=new THREE.Vector3,h.
|
|
|
t,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],t=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,t,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,t,v,w,u,x,p,y;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];p=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;t=0;for(v=y.length;t<v;t+=3)w=y[t]*e,u=y[t+1]*
|
|
|
e,x=y[t+2]*e,p.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];v=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(t=w.length;e<t;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),v.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(p in R.objects)if(!Q.objects[p])if(E=R.objects[p],E.geometry!==void 0){if(O=Q.geometries[E.geometry]){var b=!1;da=[];for(Z=0;Z<E.materials.length;Z++)da[Z]=Q.materials[E.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&O.computeTangents();D=E.position;r=E.rotation;
|
|
|
-q=E.quaternion;s=E.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,da);object.name=p;object.position.set(D[0],D[1],D[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=E.visible;Q.scene.add(object);Q.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
|
|
|
-if(E.castsShadow)b=new THREE.ShadowVolume(O),Q.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},Q.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(D[0],D[1],D[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=E.visible!==void 0?E.visible:!1,Q.scene.add(object),Q.objects[p]=object,Q.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},Q.triggers[object.name]=b)}function t(b){return function(c){Q.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function v(b){return function(e){Q.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},Q);e.onLoadProgress();Y==0&&W==0&&c(Q)}var u,
|
|
|
-x,p,y,A,z,F,E,D,G,N,O,K,H,B,da,J,R,S,Y,W,o,ea,Q;R=b.data;B=new THREE.BinaryLoader;S=new THREE.JSONLoader;W=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(E=R.objects[p],E.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;G=R.transform.rotation;var ma=R.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);G&&Q.scene.rotation.set(G[0],
|
|
|
-G[1],G[2]);ma&&Q.scene.scale.set(ma[0],ma[1],ma[2]);(b||G||ma)&&Q.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(A in R.cameras){G=R.cameras[A];if(G.type=="perspective")K=new THREE.Camera(G.fov,G.aspect,G.near,G.far),K.useTarget=!0;else if(G.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);D=G.position;G=G.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(G[0],G[1],G[2]);Q.cameras[A]=
|
|
|
-K}for(y in R.lights)A=R.lights[y],K=A.color!==void 0?A.color:16777215,G=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(D=A.direction,J=new THREE.DirectionalLight(K,G),J.position.set(D[0],D[1],D[2]),J.position.normalize()):A.type=="point"?(D=A.position,d=A.distance,J=new THREE.PointLight(K,G,d),J.position.set(D[0],D[1],D[2])):A.type=="ambient"&&(J=new THREE.AmbientLight(K)),Q.scene.add(J),Q.lights[y]=J;for(z in R.fogs)y=R.fogs[z],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type==
|
|
|
-"exp2"&&(H=new THREE.FogExp2(0,y.density)),G=y.color,H.color.setRGB(G[0],G[1],G[2]),Q.fogs[z]=H;if(Q.cameras&&R.defaults.camera)Q.currentCamera=Q.cameras[R.defaults.camera];if(Q.fogs&&R.defaults.fog)Q.scene.fog=Q.fogs[R.defaults.fog];G=R.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(G[0],G[1],G[2]);Q.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(z=R.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in R.geometries)z=R.geometries[u],z.type==
|
|
|
-"cube"?(O=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),Q.geometries[u]=O):z.type=="plane"?(O=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="sphere"?(O=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="cylinder"?(O=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),Q.geometries[u]=O):z.type=="torus"?
|
|
|
-(O=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Q.geometries[u]=O):z.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(z.subdivisions),Q.geometries[u]=O):z.type=="bin_mesh"?B.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="ascii_mesh"?S.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="embedded_mesh"&&(z=R.embeds[z.id])&&S.createModel(z,v(u),"");for(F in R.textures)if(u=R.textures[F],u.url instanceof Array){W+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else W+=
|
|
|
-1,e.onLoadStart();ea=W;for(F in R.textures){u=R.textures[F];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var Z=0;Z<u.url.length;Z++)B[Z]=f(u.url[Z],R.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,R.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],
|
|
|
-u.repeat[1]);if(u.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[u.wrap[0]]!==void 0)B.wrapS=S[u.wrap[0]];if(S[u.wrap[1]]!==void 0)B.wrapT=S[u.wrap[1]]}}Q.textures[F]=B}for(x in R.materials){F=R.materials[x];for(N in F.parameters)if(N=="envMap"||N=="map"||N=="lightMap")F.parameters[N]=Q.textures[F.parameters[N]];else if(N=="shading")F.parameters[N]=
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(p in Q.objects)if(!V.objects[p])if(E=Q.objects[p],E.geometry!==void 0){if(O=V.geometries[E.geometry]){var b=!1;ca=[];for(ha=0;ha<E.materials.length;ha++)ca[ha]=V.materials[E.materials[ha]],b=ca[ha]instanceof THREE.ShaderMaterial;b&&O.computeTangents();D=E.position;r=E.rotation;
|
|
|
+q=E.quaternion;s=E.scale;q=0;ca.length==0&&(ca[0]=new THREE.MeshFaceMaterial);ca.length>1&&(ca=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,ca);object.name=p;object.position.set(D[0],D[1],D[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=E.visible;V.scene.add(object);V.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b));
|
|
|
+if(E.castsShadow)b=new THREE.ShadowVolume(O),V.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},V.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(D[0],D[1],D[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=E.visible!==void 0?E.visible:!1,V.scene.add(object),V.objects[p]=object,V.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},V.triggers[object.name]=b)}function t(b){return function(c){V.geometries[b]=c;n();U-=1;e.onLoadComplete();w()}}function v(b){return function(e){V.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-U,loadedTextures:da-X},V);e.onLoadProgress();U==0&&X==0&&c(V)}var u,
|
|
|
+x,p,y,A,z,F,E,D,G,N,O,K,H,B,ca,J,Q,R,U,X,o,da,V;Q=b.data;B=new THREE.BinaryLoader;R=new THREE.JSONLoader;X=U=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in Q.objects)if(E=Q.objects[p],E.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;G=Q.transform.rotation;var la=Q.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0],
|
|
|
+G[1],G[2]);la&&V.scene.scale.set(la[0],la[1],la[2]);(b||G||la)&&V.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(A in Q.cameras){G=Q.cameras[A];if(G.type=="perspective")K=new THREE.Camera(G.fov,G.aspect,G.near,G.far),K.useTarget=!0;else if(G.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);D=G.position;G=G.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(G[0],G[1],G[2]);V.cameras[A]=
|
|
|
+K}for(y in Q.lights)A=Q.lights[y],K=A.color!==void 0?A.color:16777215,G=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(D=A.direction,J=new THREE.DirectionalLight(K,G),J.position.set(D[0],D[1],D[2]),J.position.normalize()):A.type=="point"?(D=A.position,d=A.distance,J=new THREE.PointLight(K,G,d),J.position.set(D[0],D[1],D[2])):A.type=="ambient"&&(J=new THREE.AmbientLight(K)),V.scene.add(J),V.lights[y]=J;for(z in Q.fogs)y=Q.fogs[z],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type==
|
|
|
+"exp2"&&(H=new THREE.FogExp2(0,y.density)),G=y.color,H.color.setRGB(G[0],G[1],G[2]),V.fogs[z]=H;if(V.cameras&&Q.defaults.camera)V.currentCamera=V.cameras[Q.defaults.camera];if(V.fogs&&Q.defaults.fog)V.scene.fog=V.fogs[Q.defaults.fog];G=Q.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(G[0],G[1],G[2]);V.bgColorAlpha=Q.defaults.bgalpha;for(u in Q.geometries)if(z=Q.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")U+=1,e.onLoadStart();o=U;for(u in Q.geometries)z=Q.geometries[u],z.type==
|
|
|
+"cube"?(O=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),V.geometries[u]=O):z.type=="plane"?(O=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),V.geometries[u]=O):z.type=="sphere"?(O=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),V.geometries[u]=O):z.type=="cylinder"?(O=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),V.geometries[u]=O):z.type=="torus"?
|
|
|
+(O=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),V.geometries[u]=O):z.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(z.subdivisions),V.geometries[u]=O):z.type=="bin_mesh"?B.load({model:f(z.url,Q.urlBaseType),callback:t(u)}):z.type=="ascii_mesh"?R.load({model:f(z.url,Q.urlBaseType),callback:t(u)}):z.type=="embedded_mesh"&&(z=Q.embeds[z.id])&&R.createModel(z,v(u),"");for(F in Q.textures)if(u=Q.textures[F],u.url instanceof Array){X+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else X+=
|
|
|
+1,e.onLoadStart();da=X;for(F in Q.textures){u=Q.textures[F];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var ha=0;ha<u.url.length;ha++)B[ha]=f(u.url[ha],Q.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,Q.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],
|
|
|
+u.repeat[1]);if(u.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[u.wrap[0]]!==void 0)B.wrapS=R[u.wrap[0]];if(R[u.wrap[1]]!==void 0)B.wrapT=R[u.wrap[1]]}}V.textures[F]=B}for(x in Q.materials){F=Q.materials[x];for(N in F.parameters)if(N=="envMap"||N=="map"||N=="lightMap")F.parameters[N]=V.textures[F.parameters[N]];else if(N=="shading")F.parameters[N]=
|
|
|
F.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")F.parameters[N]=THREE[F.parameters[N]]?THREE[F.parameters[N]]:THREE.NormalBlending;else if(N=="combine")F.parameters[N]=F.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(F.parameters[N]=="face")F.parameters[N]=THREE.FaceColors;else if(F.parameters[N])F.parameters[N]=THREE.VertexColors;if(F.parameters.opacity!==void 0&&F.parameters.opacity<1)F.parameters.transparent=
|
|
|
-!0;if(F.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=F.parameters.color;S=F.parameters.specular;z=F.parameters.ambient;H=F.parameters.shininess;b.tNormal.texture=Q.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
|
|
|
-Q.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(S);b.uAmbientColor.value.setHex(z);b.uShininess.value=H;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);Q.materials[x]=F}n();e.callbackSync(Q)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+!0;if(F.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=F.parameters.color;R=F.parameters.specular;z=F.parameters.ambient;H=F.parameters.shininess;b.tNormal.texture=V.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
|
|
|
+V.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(R);b.uAmbientColor.value.setHex(z);b.uShininess.value=H;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);V.materials[x]=F}n();e.callbackSync(V)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,m,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
|
|
|
THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
|
|
|
THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),v=[],w=[];(function(b,m,p){for(var t,v,w,F=b.length;p<F;p+=m)t=b[p],v=b[p+1],w=b[p+2],t=t/16383*e,v=v/16383*e,w=w/16383*e,t+=f,v+=h,w+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,v,w)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
|
|
|
-e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,v.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,t,E,D,G,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;t=k;E=f;var O=h,K=k,H=m.materials[0],B=v[O*3],da=v[O*3+1],O=v[O*3+2],J=v[K*3],R=v[K*3+1],K=v[K*3+2];E=new THREE.Vector3(v[E*3],v[E*3+1],v[E*3+2]);O=new THREE.Vector3(B,da,O);K=new THREE.Vector3(J,R,K);m.faces.push(new THREE.Face3(D,G,t,[E,O,K],null,H));m=w[f*2];f=w[f*
|
|
|
+e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,v.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,t,E,D,G,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;t=k;E=f;var O=h,K=k,H=m.materials[0],B=v[O*3],ca=v[O*3+1],O=v[O*3+2],J=v[K*3],Q=v[K*3+1],K=v[K*3+2];E=new THREE.Vector3(v[E*3],v[E*3+1],v[E*3+2]);O=new THREE.Vector3(B,ca,O);K=new THREE.Vector3(J,Q,K);m.faces.push(new THREE.Face3(D,G,t,[E,O,K],null,H));m=w[f*2];f=w[f*
|
|
|
2+1];t=w[h*2];E=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=t;t=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,t));E.push(new THREE.UV(D,G));k.push(E)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
|
|
|
e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
@@ -643,9 +643,9 @@ THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c ins
|
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=t;c[k+2]=v;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=t+m*this.delta;c[k+
|
|
|
2]=v;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=t;c[k+2]=v+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var t=k+1,v=k+this.yd,w=k+this.zd,u=t+this.yd,x=t+this.zd,p=k+this.yd+this.zd,y=t+this.yd+this.zd,A=0,z=this.field[k],F=this.field[t],E=this.field[v],D=this.field[u],G=this.field[w],N=this.field[x],O=this.field[p],K=this.field[y];z<m&&(A|=1);F<m&&(A|=2);E<m&&(A|=8);D<m&&(A|=4);G<m&&(A|=16);N<m&&(A|=32);O<m&&(A|=128);K<m&&(A|=64);var H=THREE.edgeTable[A];if(H==0)return 0;var B=this.delta,
|
|
|
-da=b+B,J=c+B,B=h+B;H&1&&(this.compNorm(k),this.compNorm(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,z,F));H&2&&(this.compNorm(t),this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,3,m,da,c,h,F,D));H&4&&(this.compNorm(v),this.compNorm(u),this.VIntX(v*3,this.vlist,this.nlist,6,m,b,J,h,E,D));H&8&&(this.compNorm(k),this.compNorm(v),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,z,E));H&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,G,N));H&32&&(this.compNorm(x),
|
|
|
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,N,K));H&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,m,b,J,B,O,K));H&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,G,O));H&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,z,G));H&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,da,c,h,F,N));H&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
|
|
|
-3,this.vlist,this.nlist,30,m,da,J,h,D,K));H&2048&&(this.compNorm(v),this.compNorm(p),this.VIntZ(v*3,this.vlist,this.nlist,33,m,b,J,h,E,O));A<<=4;for(m=k=0;THREE.triTable[A+m]!=-1;)b=A+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[k];this.positionArray[t+
|
|
|
+ca=b+B,J=c+B,B=h+B;H&1&&(this.compNorm(k),this.compNorm(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,z,F));H&2&&(this.compNorm(t),this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,3,m,ca,c,h,F,D));H&4&&(this.compNorm(v),this.compNorm(u),this.VIntX(v*3,this.vlist,this.nlist,6,m,b,J,h,E,D));H&8&&(this.compNorm(k),this.compNorm(v),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,z,E));H&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,G,N));H&32&&(this.compNorm(x),
|
|
|
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,ca,c,B,N,K));H&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,m,b,J,B,O,K));H&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,G,O));H&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,z,G));H&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,ca,c,h,F,N));H&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
|
|
|
+3,this.vlist,this.nlist,30,m,ca,J,h,D,K));H&2048&&(this.compNorm(v),this.compNorm(p),this.VIntZ(v*3,this.vlist,this.nlist,33,m,b,J,h,E,O));A<<=4;for(m=k=0;THREE.triTable[A+m]!=-1;)b=A+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[k];this.positionArray[t+
|
|
|
4]=b[k+1];this.positionArray[t+5]=b[k+2];this.positionArray[t+6]=b[m];this.positionArray[t+7]=b[m+1];this.positionArray[t+8]=b[m+2];this.normalArray[t]=c[h];this.normalArray[t+1]=c[h+1];this.normalArray[t+2]=c[h+2];this.normalArray[t+3]=c[k];this.normalArray[t+4]=c[k+1];this.normalArray[t+5]=c[k+2];this.normalArray[t+6]=c[m];this.normalArray[t+7]=c[m+1];this.normalArray[t+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
|
|
|
this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,m){var n=this.size*Math.sqrt(k/m),t=h*this.size,v=c*this.size,w=b*this.size,u=Math.floor(t-n);u<1&&(u=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
|
|
|
1);for(var y,A,z,F,E,D;u<t;u++){w=this.size2*u;A=u/this.size-h;E=A*A;for(A=x;A<v;A++){z=w+this.size*A;y=A/this.size-c;D=y*y;for(y=p;y<n;y++)F=y/this.size-b,F=k/(1.0E-6+F*F+D+E)-m,F>0&&(this.field[z+y]+=F)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,v=this.size,w=this.yd,u=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h<p;h++)if(k=h/v,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<v;k++){t=h+k*w;for(m=0;m<v;m++)x[u*m+t]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,t,v,w=this.size,u=this.yd,x=
|