|
@@ -27,7 +27,7 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,
|
|
|
c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.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,m=b.n14,k=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,v=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12,
|
|
|
-H=c.n13,M=c.n14,Q=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,R=c.n33,T=c.n34,V=c.n41,X=c.n42,o=c.n43,ha=c.n44;this.n11=e*E+f*Q+h*W+m*V;this.n12=e*G+f*J+h*D+m*X;this.n13=e*H+f*I+h*R+m*o;this.n14=e*M+f*K+h*T+m*ha;this.n21=k*E+n*Q+t*W+u*V;this.n22=k*G+n*J+t*D+u*X;this.n23=k*H+n*I+t*R+u*o;this.n24=k*M+n*K+t*T+u*ha;this.n31=w*E+v*Q+x*W+p*V;this.n32=w*G+v*J+x*D+p*X;this.n33=w*H+v*I+x*R+p*o;this.n34=w*M+v*K+x*T+p*ha;this.n41=y*E+z*Q+A*W+C*V;this.n42=y*G+z*J+A*D+C*X;this.n43=y*H+z*I+A*R+C*o;this.n44=y*
|
|
|
+H=c.n13,M=c.n14,Q=c.n21,J=c.n22,I=c.n23,K=c.n24,X=c.n31,D=c.n32,R=c.n33,T=c.n34,V=c.n41,W=c.n42,o=c.n43,ha=c.n44;this.n11=e*E+f*Q+h*X+m*V;this.n12=e*G+f*J+h*D+m*W;this.n13=e*H+f*I+h*R+m*o;this.n14=e*M+f*K+h*T+m*ha;this.n21=k*E+n*Q+t*X+u*V;this.n22=k*G+n*J+t*D+u*W;this.n23=k*H+n*I+t*R+u*o;this.n24=k*M+n*K+t*T+u*ha;this.n31=w*E+v*Q+x*X+p*V;this.n32=w*G+v*J+x*D+p*W;this.n33=w*H+v*I+x*R+p*o;this.n34=w*M+v*K+x*T+p*ha;this.n41=y*E+z*Q+A*X+C*V;this.n42=y*G+z*J+A*D+C*W;this.n43=y*H+z*I+A*R+C*o;this.n44=y*
|
|
|
M+z*K+A*T+C*ha;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,m=this.n22,k=this.n23,n=this.n24,t=this.n31,u=this.n32,w=this.n33,v=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*u*x-e*n*u*x-f*m*w*x+c*n*w*x+e*m*v*x-c*k*v*x-f*k*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*v*p+b*k*v*p+f*m*t*y-c*n*t*y-f*h*u*y+b*n*u*y+c*h*v*y-b*m*v*y-e*m*t*z+c*k*t*z+e*h*u*z-b*k*u*z-c*h*
|
|
|
w*z+b*m*w*z},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=
|
|
@@ -55,10 +55,10 @@ 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,m=[],k,n,t=[],u,w,v=[],x,p=[],y,z,A=[],C,E,G=[],H=[],M=[],Q=new THREE.Vector4,J=new THREE.Vector4,
|
|
|
-I=new THREE.Matrix4,K=new THREE.Matrix4,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){I.multiply(e.projectionMatrix,e.matrixWorldInverse);I.multiplyVector3(b);return b};this.unprojectVector=function(b,e){I.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));I.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=H.length=0;
|
|
|
-o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var v=n.matrixWorld,t=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=W[u].x*v.n14+W[u].y*v.n24+W[u].z*v.n34+W[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=m[h]=m[h]||new THREE.RenderableObject,h++,f=p,Q.copy(n.position),I.multiplyVector3(Q),f.object=n,f.z=Q.z,H.push(f)}k&&H.sort(c);return H};this.projectScene=
|
|
|
-function(f,h,m){var o=h.near,H=h.far,Q,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa,N,ea,qa,ua;E=z=x=w=M.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);W[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);W[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);W[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);W[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);W[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);
|
|
|
-W[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(Q=0;Q<6;Q++)U=W[Q],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,h,!0);f=0;for(Q=U.length;f<Q;f++)if($=U[f].object,$.visible)if(da=$.matrixWorld,ja=$.matrixRotationWorld,sa=$.materials,N=$.overdraw,n=0,$ instanceof THREE.Mesh){ea=$.geometry;ra=ea.vertices;qa=ea.faces;ea=ea.faceVertexUvs;ma=0;for(ca=ra.length;ma<ca;ma++)k=b(),k.positionWorld.copy(ra[ma].position),da.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
|
|
|
+I=new THREE.Matrix4,K=new THREE.Matrix4,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){I.multiply(e.projectionMatrix,e.matrixWorldInverse);I.multiplyVector3(b);return b};this.unprojectVector=function(b,e){I.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));I.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=H.length=0;
|
|
|
+o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var v=n.matrixWorld,t=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=X[u].x*v.n14+X[u].y*v.n24+X[u].z*v.n34+X[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=m[h]=m[h]||new THREE.RenderableObject,h++,f=p,Q.copy(n.position),I.multiplyVector3(Q),f.object=n,f.z=Q.z,H.push(f)}k&&H.sort(c);return H};this.projectScene=
|
|
|
+function(f,h,m){var o=h.near,H=h.far,Q,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa,N,ea,qa,ua;E=z=x=w=M.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);X[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);X[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);X[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);X[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);X[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);
|
|
|
+X[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(Q=0;Q<6;Q++)U=X[Q],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,h,!0);f=0;for(Q=U.length;f<Q;f++)if($=U[f].object,$.visible)if(da=$.matrixWorld,ja=$.matrixRotationWorld,sa=$.materials,N=$.overdraw,n=0,$ instanceof THREE.Mesh){ea=$.geometry;ra=ea.vertices;qa=ea.faces;ea=ea.faceVertexUvs;ma=0;for(ca=ra.length;ma<ca;ma++)k=b(),k.positionWorld.copy(ra[ma].position),da.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
|
|
|
I.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<H;ra=0;for(ma=qa.length;ra<ma;ra++){ca=qa[ra];if(ca instanceof THREE.Face3)if(la=t[ca.a],pa=t[ca.b],fa=t[ca.c],la.visible&&pa.visible&&fa.visible&&($.doubleSided||$.flipSided!=(fa.positionScreen.x-la.positionScreen.x)*(pa.positionScreen.y-la.positionScreen.y)-(fa.positionScreen.y-la.positionScreen.y)*(pa.positionScreen.x-la.positionScreen.x)<
|
|
|
0))ia=v[w]=v[w]||new THREE.RenderableFace3,w++,u=ia,u.v1.copy(la),u.v2.copy(pa),u.v3.copy(fa);else continue;else if(ca instanceof THREE.Face4)if(la=t[ca.a],pa=t[ca.b],fa=t[ca.c],ia=t[ca.d],la.visible&&pa.visible&&fa.visible&&ia.visible&&($.doubleSided||$.flipSided!=((ia.positionScreen.x-la.positionScreen.x)*(pa.positionScreen.y-la.positionScreen.y)-(ia.positionScreen.y-la.positionScreen.y)*(pa.positionScreen.x-la.positionScreen.x)<0||(pa.positionScreen.x-fa.positionScreen.x)*(ia.positionScreen.y-
|
|
|
fa.positionScreen.y)-(pa.positionScreen.y-fa.positionScreen.y)*(ia.positionScreen.x-fa.positionScreen.x)<0)))ua=p[x]=p[x]||new THREE.RenderableFace4,x++,u=ua,u.v1.copy(la),u.v2.copy(pa),u.v3.copy(fa),u.v4.copy(ia);else continue;u.normalWorld.copy(ca.normal);ja.multiplyVector3(u.normalWorld);u.centroidWorld.copy(ca.centroid);da.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);I.multiplyVector3(u.centroidScreen);fa=ca.vertexNormals;la=0;for(pa=fa.length;la<pa;la++)ia=u.vertexNormalsWorld[la],
|
|
@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){t
|
|
|
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=
|
|
|
this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,t=this.w,u=t*e+k*h-n*f,w=t*f+n*e-m*h,v=t*h+m*f-k*e,e=-m*
|
|
|
-e-k*f-n*h;c.x=u*t+e*-m+w*-n-v*-k;c.y=w*t+e*-k+v*-m-u*-n;c.z=v*t+e*-n+u*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
|
|
|
+e-k*f-n*h;c.x=u*t+e*-m+w*-n-v*-k;c.y=w*t+e*-k+v*-m-u*-n;c.z=v*t+e*-n+u*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
|
|
|
THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
@@ -79,9 +79,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
|
|
|
e,f,h,m,k,n=new THREE.Vector3,t=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){m=this.faces[f];if(b&&m.vertexNormals.length){n.set(0,0,0);c=0;for(e=m.vertexNormals.length;c<e;c++)n.addSelf(m.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[m.a],e=this.vertices[m.b],k=this.vertices[m.c],n.sub(k.position,e.position),t.sub(c.position,e.position),n.crossSelf(t);n.isZero()||n.normalize();m.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,h,m,o){n=b.vertices[e].position;t=b.vertices[c].position;u=b.vertices[f].position;w=k[h];v=k[m];x=k[o];p=t.x-n.x;y=u.x-n.x;z=t.y-n.y;A=u.y-n.y;C=t.z-n.z;E=u.z-n.z;G=v.u-w.u;H=x.u-w.u;M=v.v-w.v;Q=x.v-w.v;J=1/(G*Q-H*M);D.set((Q*p-M*y)*J,(Q*z-M*A)*J,(Q*C-M*E)*J);R.set((G*y-H*p)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);W[e].addSelf(R);
|
|
|
-W[c].addSelf(R);W[f].addSelf(R)}var c,e,f,h,m,k,n,t,u,w,v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K=[],W=[],D=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,V=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
|
|
|
-"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)X.copy(m.vertexNormals[f]),h=m[o[f]],I=K[h],T.copy(I),T.subSelf(X.multiplyScalar(X.dot(I))).normalize(),V.cross(m.vertexNormals[f],I),h=V.dot(W[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(T.x,T.y,T.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,h,m,o){n=b.vertices[e].position;t=b.vertices[c].position;u=b.vertices[f].position;w=k[h];v=k[m];x=k[o];p=t.x-n.x;y=u.x-n.x;z=t.y-n.y;A=u.y-n.y;C=t.z-n.z;E=u.z-n.z;G=v.u-w.u;H=x.u-w.u;M=v.v-w.v;Q=x.v-w.v;J=1/(G*Q-H*M);D.set((Q*p-M*y)*J,(Q*z-M*A)*J,(Q*C-M*E)*J);R.set((G*y-H*p)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);X[e].addSelf(R);
|
|
|
+X[c].addSelf(R);X[f].addSelf(R)}var c,e,f,h,m,k,n,t,u,w,v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K=[],X=[],D=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,X[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
|
|
|
+"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)W.copy(m.vertexNormals[f]),h=m[o[f]],I=K[h],T.copy(I),T.subSelf(W.multiplyScalar(W.dot(I))).normalize(),V.cross(m.vertexNormals[f],I),h=V.dot(X[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(T.x,T.y,T.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}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
|
|
|
{};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
|
|
@@ -149,24 +149,24 @@ THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addO
|
|
|
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,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var t,u,w,v,x,p,y,z;b=c.projectScene(e,f);t=0;for(u=b.length;t<u;t++)if(x=b[t],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*m+m;w=0;for(v=x.material.length;w<v;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=z+"px"}}};
|
|
|
THREE.CanvasRenderer=function(b){function c(b){if(A!=b)p.globalAlpha=A=b}function e(b){if(C!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}C=b}}function f(b){if(E!=b)p.strokeStyle=E=b}function h(b){if(G!=b)p.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-u,w,v,x,p=t.getContext("2d"),y=new THREE.Color(0),z=0,A=1,C=0,E=null,G=null,H=null,M=null,Q=null,J,I,K,W,D=new THREE.RenderableVertex,R=new THREE.RenderableVertex,T,V,X,o,ha,S,ma,ca,ra,la,pa,fa,ia=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),da=new THREE.Color(0),ja=new THREE.Color(0),sa=[],N,ea,qa,ua,ta,Ba,Ca,va,Aa,Ea,L=new THREE.Rectangle,O=new THREE.Rectangle,ga=new THREE.Rectangle,aa=!1,ka=new THREE.Color,oa=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,na=new THREE.Vector3,
|
|
|
+u,w,v,x,p=t.getContext("2d"),y=new THREE.Color(0),z=0,A=1,C=0,E=null,G=null,H=null,M=null,Q=null,J,I,K,X,D=new THREE.RenderableVertex,R=new THREE.RenderableVertex,T,V,W,o,ha,S,ma,ca,ra,la,pa,fa,ia=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),da=new THREE.Color(0),ja=new THREE.Color(0),sa=[],N,ea,qa,ua,ta,Ba,Ca,va,Aa,Ea,L=new THREE.Rectangle,O=new THREE.Rectangle,ga=new THREE.Rectangle,aa=!1,ka=new THREE.Color,oa=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,na=new THREE.Vector3,
|
|
|
ya,Z,Fa,Y,Va,Wa,b=16;ya=document.createElement("canvas");ya.width=ya.height=2;Z=ya.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Fa=Z.getImageData(0,0,2,2);Y=Fa.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.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){u=b;w=e;v=Math.floor(u/2);x=Math.floor(w/2);t.width=u;t.height=
|
|
|
w;L.set(-v,-x,v,x);O.set(-v,-x,v,x);A=1;C=0;Q=M=H=G=E=null};this.setClearColor=function(b,e){y.copy(b);z=e;O.set(-v,-x,v,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;O.set(-v,-x,v,x)};this.clear=function(){p.setTransform(1,0,0,-1,v,x);O.isEmpty()||(O.minSelf(L),O.inflate(2),z<1&&p.clearRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
255)+","+z+")"),p.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function t(b){var e,c,f,k=b.lights;oa.setRGB(0,0,0);za.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?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):c instanceof THREE.DirectionalLight?(za.r+=f.r,za.g+=f.g,za.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(na.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,u,Y,t,w;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)Y=
|
|
|
m.map.image,t=Y.width>>1,w=Y.height>>1,m=k.scale.x*v,u=k.scale.y*x,o=m*t,n=u*w,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-u),p.translate(-t,-w),p.drawImage(Y,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,n=k.scale.y*x,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(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(H!=b)p.lineWidth=H=b;b=m.linecap;if(M!=b)p.lineCap=M=b;b=m.linejoin;if(Q!=b)p.lineJoin=Q=b;f(m.color.getContextStyle());p.stroke();ga.inflate(m.linewidth*2)}}function A(b,f,k,h,n,v,Y,p,t){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending);
|
|
|
-T=b.positionScreen.x;V=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ha=k.positionScreen.x;S=k.positionScreen.y;E(T,V,X,o,ha,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,X,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,na.copy(Y.vertexNormalsWorld[0]),ta=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,
|
|
|
-Ba=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[1]),Ca=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[2]),Aa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(T,V,X,o,ha,S,ta,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
|
|
|
-(p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,X,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&Y.vertexNormalsWorld.length==3?(U.r=$.r=da.r=oa.r,U.g=$.g=da.g=oa.g,U.b=$.b=da.b=oa.b,w(t,Y.v1.positionWorld,Y.vertexNormalsWorld[0],U),w(t,Y.v2.positionWorld,Y.vertexNormalsWorld[1],$),w(t,Y.v3.positionWorld,Y.vertexNormalsWorld[2],da),U.r=Math.max(0,Math.min(p.color.r*U.r,1)),U.g=Math.max(0,
|
|
|
-Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),$.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)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,X,o,ha,S,0,0,1,0,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,Y.centroidWorld,Y.normalWorld,
|
|
|
+T=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ha=k.positionScreen.x;S=k.positionScreen.y;E(T,V,W,o,ha,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,W,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,na.copy(Y.vertexNormalsWorld[0]),ta=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,
|
|
|
+Ba=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[1]),Ca=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[2]),Aa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(T,V,W,o,ha,S,ta,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
|
|
|
+(p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,W,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&Y.vertexNormalsWorld.length==3?(U.r=$.r=da.r=oa.r,U.g=$.g=da.g=oa.g,U.b=$.b=da.b=oa.b,w(t,Y.v1.positionWorld,Y.vertexNormalsWorld[0],U),w(t,Y.v2.positionWorld,Y.vertexNormalsWorld[1],$),w(t,Y.v3.positionWorld,Y.vertexNormalsWorld[2],da),U.r=Math.max(0,Math.min(p.color.r*U.r,1)),U.g=Math.max(0,
|
|
|
+Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),$.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)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,W,o,ha,S,0,0,1,0,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,Y.centroidWorld,Y.normalWorld,
|
|
|
ka),ia.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ka.b,1)),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(k.positionScreen.z,
|
|
|
-N,ea),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,X,o,ha,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)ia.r=Ta(Y.normalWorld.x),ia.g=Ta(Y.normalWorld.y),ia.b=Ta(Y.normalWorld.z),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)}function C(b,f,k,h,n,p,v,Y,t){m.info.render.vertices+=4;m.info.render.faces++;c(Y.opacity);e(Y.blending);if(Y.map||Y.envMap)A(b,f,h,0,1,3,v,Y,t),A(n,k,p,1,2,3,v,Y,t);else if(T=b.positionScreen.x,
|
|
|
-V=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ha=k.positionScreen.x,S=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,ra=n.positionScreen.x,la=n.positionScreen.y,pa=p.positionScreen.x,fa=p.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)aa?!Y.wireframe&&Y.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
+N,ea),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,W,o,ha,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)ia.r=Ta(Y.normalWorld.x),ia.g=Ta(Y.normalWorld.y),ia.b=Ta(Y.normalWorld.z),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)}function C(b,f,k,h,n,p,v,Y,t){m.info.render.vertices+=4;m.info.render.faces++;c(Y.opacity);e(Y.blending);if(Y.map||Y.envMap)A(b,f,h,0,1,3,v,Y,t),A(n,k,p,1,2,3,v,Y,t);else if(T=b.positionScreen.x,
|
|
|
+V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ha=k.positionScreen.x,S=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,ra=n.positionScreen.x,la=n.positionScreen.y,pa=p.positionScreen.x,fa=p.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)aa?!Y.wireframe&&Y.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
4?(U.r=$.r=da.r=ja.r=oa.r,U.g=$.g=da.g=ja.g=oa.g,U.b=$.b=da.b=ja.b=oa.b,w(t,v.v1.positionWorld,v.vertexNormalsWorld[0],U),w(t,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(t,v.v4.positionWorld,v.vertexNormalsWorld[3],da),w(t,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),$.r=Math.max(0,Math.min(Y.color.r*$.r,1)),$.g=Math.max(0,Math.min(Y.color.g*$.g,1)),$.b=Math.max(0,Math.min(Y.color.b*
|
|
|
-$.b,1)),da.r=Math.max(0,Math.min(Y.color.r*da.r,1)),da.g=Math.max(0,Math.min(Y.color.g*da.g,1)),da.b=Math.max(0,Math.min(Y.color.b*da.b,1)),ja.r=Math.max(0,Math.min(Y.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(Y.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(Y.color.b*ja.b,1)),qa=Xa(U,$,da,ja),E(T,V,X,o,ma,ca),Sa(T,V,X,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,v.centroidWorld,v.normalWorld,ka),ia.r=Math.max(0,Math.min(Y.color.r*ka.r,
|
|
|
-1)),ia.g=Math.max(0,Math.min(Y.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(Y.color.b*ka.b,1)),G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia)):(G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)ia.r=Ta(v.normalWorld.x),ia.g=Ta(v.normalWorld.y),ia.b=Ta(v.normalWorld.z),G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,
|
|
|
-Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia);else if(Y instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(h.positionScreen.z,N,ea),ja.r=ja.g=ja.b=1-Na(k.positionScreen.z,N,ea),qa=Xa(U,$,da,ja),E(T,V,X,o,ma,ca),Sa(T,V,X,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)}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);
|
|
|
+$.b,1)),da.r=Math.max(0,Math.min(Y.color.r*da.r,1)),da.g=Math.max(0,Math.min(Y.color.g*da.g,1)),da.b=Math.max(0,Math.min(Y.color.b*da.b,1)),ja.r=Math.max(0,Math.min(Y.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(Y.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(Y.color.b*ja.b,1)),qa=Xa(U,$,da,ja),E(T,V,W,o,ma,ca),Sa(T,V,W,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,v.centroidWorld,v.normalWorld,ka),ia.r=Math.max(0,Math.min(Y.color.r*ka.r,
|
|
|
+1)),ia.g=Math.max(0,Math.min(Y.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(Y.color.b*ka.b,1)),G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia)):(G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)ia.r=Ta(v.normalWorld.x),ia.g=Ta(v.normalWorld.y),ia.b=Ta(v.normalWorld.z),G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,
|
|
|
+Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia);else if(Y instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(h.positionScreen.z,N,ea),ja.r=ja.g=ja.b=1-Na(k.positionScreen.z,N,ea),qa=Xa(U,$,da,ja),E(T,V,W,o,ma,ca),Sa(T,V,W,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)}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 G(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 Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(M!=c)p.lineCap=M=c;if(Q!=k)p.lineJoin=Q=k;f(b.getContextStyle());p.stroke();ga.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,Y,v,u,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||sa[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;sa[w.id]=
|
|
|
p.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,Y=(Y+x)*L,v=(v+Ma)*w,u=(u+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;Y-=o;v-=n;u-=o;t-=n;x=1/(Y*t-u*v);w=(t*c-v*k)*x;v=(t*f-v*m)*x;c=(Y*k-u*c)*x;f=(Y*m-u*f)*x;b=b-w*o-c*n;e=e-v*o-f*n;p.save();p.transform(w,v,c,f,b,e);p.fill();p.restore()}}function Sa(b,e,
|
|
|
c,f,k,h,m,o,n,Y,v,u,t){var w,x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;Y*=x;v*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;Y-=o;v-=m;u-=o;x=1/(n*u-v*Y);w=(u*c-Y*k)*x;Y=(u*f-Y*h)*x;c=(n*k-v*c)*x;f=(n*h-v*f)*x;b=b-w*m-c*o;e=e-Y*m-f*o;p.save();p.transform(w,Y,c,f,b,e);p.clip();p.drawImage(t,0,0);p.restore()}function Xa(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),v=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Y[0]=k<0?0:k>255?
|
|
@@ -174,18 +174,18 @@ c,f,k,h,m,o,n,Y,v,u,t){var w,x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;Y*=x;v*=w
|
|
|
e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():p.setTransform(1,0,0,-1,v,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(aa=b.lights.length>0)&&t(b);Ya=0;for(db=k.length;Ya<db;Ya++){wa=k[Ya];ga.empty();if(wa instanceof THREE.RenderableParticle){J=wa;J.x*=v;J.y*=x;Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&y(J,wa,F,b)}else if(wa instanceof THREE.RenderableLine){if(J=wa.v1,I=wa.v2,J.positionScreen.x*=
|
|
|
v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,ga.addPoint(J.positionScreen.x,J.positionScreen.y),ga.addPoint(I.positionScreen.x,I.positionScreen.y),L.intersects(ga)){Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&z(J,I,wa,F,b)}}else if(wa instanceof THREE.RenderableFace3){if(J=wa.v1,I=wa.v2,K=wa.v3,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,wa.overdraw&&(Ka(J.positionScreen,
|
|
|
I.positionScreen),Ka(I.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),ga.add3Points(J.positionScreen.x,J.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(ga)){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&A(J,I,K,0,1,2,wa,F,b)}else F.opacity!=0&&A(J,I,K,0,1,2,wa,F,b)}}else if(wa instanceof
|
|
|
-THREE.RenderableFace4&&(J=wa.v1,I=wa.v2,K=wa.v3,W=wa.v4,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,W.positionScreen.x*=v,W.positionScreen.y*=x,D.positionScreen.copy(I.positionScreen),R.positionScreen.copy(W.positionScreen),wa.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,W.positionScreen),Ka(W.positionScreen,J.positionScreen),Ka(K.positionScreen,D.positionScreen),Ka(K.positionScreen,R.positionScreen)),
|
|
|
-ga.addPoint(J.positionScreen.x,J.positionScreen.y),ga.addPoint(I.positionScreen.x,I.positionScreen.y),ga.addPoint(K.positionScreen.x,K.positionScreen.y),ga.addPoint(W.positionScreen.x,W.positionScreen.y),L.intersects(ga))){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&C(J,I,K,W,D,R,wa,F,b)}else F.opacity!=0&&C(J,I,K,W,D,R,wa,F,b)}O.addRectangle(ga)}p.setTransform(1,
|
|
|
+THREE.RenderableFace4&&(J=wa.v1,I=wa.v2,K=wa.v3,X=wa.v4,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,X.positionScreen.x*=v,X.positionScreen.y*=x,D.positionScreen.copy(I.positionScreen),R.positionScreen.copy(X.positionScreen),wa.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,X.positionScreen),Ka(X.positionScreen,J.positionScreen),Ka(K.positionScreen,D.positionScreen),Ka(K.positionScreen,R.positionScreen)),
|
|
|
+ga.addPoint(J.positionScreen.x,J.positionScreen.y),ga.addPoint(I.positionScreen.x,I.positionScreen.y),ga.addPoint(K.positionScreen.x,K.positionScreen.y),ga.addPoint(X.positionScreen.x,X.positionScreen.y),L.intersects(ga))){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&C(J,I,K,X,D,R,wa,F,b)}else F.opacity!=0&&C(J,I,K,X,D,R,wa,F,b)}O.addRectangle(ga)}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&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*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,k,o,n,v){m.info.render.vertices+=3;m.info.render.faces++;T=f(V++);
|
|
|
+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&&(X.sub(h.position,e.centroidWorld),X.normalize(),m=e.normalWorld.dot(X)*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,k,o,n,v){m.info.render.vertices+=3;m.info.render.faces++;T=f(V++);
|
|
|
T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(v,o,M),H.r=Math.max(0,Math.min(n.color.r*M.r,1)),H.g=Math.max(0,Math.min(n.color.g*M.g,1)),H.b=Math.max(0,Math.min(n.color.b*M.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
|
|
|
o.z*n.__farMinusNear),H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(T)}function e(e,c,k,o,n,v,p){m.info.render.vertices+=
|
|
|
4;m.info.render.faces++;T=f(V++);T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?H.copy(v.color):v instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(p,n,M),H.r=Math.max(0,Math.min(v.color.r*M.r,1)),H.g=Math.max(0,Math.min(v.color.g*M.g,1)),H.b=Math.max(0,Math.min(v.color.b*M.b,1))):
|
|
|
H.copy(v.color):v instanceof THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),H.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));v.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+
|
|
|
"; fill-opacity: "+v.opacity);t.appendChild(T)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,v,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),M=new THREE.Color(16777215),Q=new THREE.Color(0),
|
|
|
-J=new THREE.Color(0),I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],R=[],T,V,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){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
-this.render=function(b,f){var h,u,w,H,M,D,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);X=V=0;if(G=b.lights.length>0){K=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=K.length;h<u;h++)w=K[h],H=w.color,w instanceof THREE.AmbientLight?(Q.r+=H.r,Q.g+=H.g,Q.b+=H.b):w instanceof THREE.DirectionalLight?(J.r+=H.r,J.g+=H.g,J.b+=H.b):w instanceof THREE.PointLight&&(I.r+=H.r,I.g+=H.g,I.b+=H.b)}h=0;for(u=k.length;h<
|
|
|
-u;h++)if(K=k[h],E.empty(),K instanceof THREE.RenderableParticle){p=K;p.x*=v;p.y*=-x;w=0;for(H=K.materials.length;w<H;)w++}else if(K instanceof THREE.RenderableLine){if(p=K.v1,y=K.v2,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(H=K.materials.length;w<H;)if((U=K.materials[w++])&&U.opacity!=0){M=p;D=y;var $=X++;R[$]==null&&(R[$]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+J=new THREE.Color(0),I=new THREE.Color(0),K,X=new THREE.Vector3,D=[],R=[],T,V,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){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
+this.render=function(b,f){var h,u,w,H,M,D,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(G=b.lights.length>0){K=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=K.length;h<u;h++)w=K[h],H=w.color,w instanceof THREE.AmbientLight?(Q.r+=H.r,Q.g+=H.g,Q.b+=H.b):w instanceof THREE.DirectionalLight?(J.r+=H.r,J.g+=H.g,J.b+=H.b):w instanceof THREE.PointLight&&(I.r+=H.r,I.g+=H.g,I.b+=H.b)}h=0;for(u=k.length;h<
|
|
|
+u;h++)if(K=k[h],E.empty(),K instanceof THREE.RenderableParticle){p=K;p.x*=v;p.y*=-x;w=0;for(H=K.materials.length;w<H;)w++}else if(K instanceof THREE.RenderableLine){if(p=K.v1,y=K.v2,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(H=K.materials.length;w<H;)if((U=K.materials[w++])&&U.opacity!=0){M=p;D=y;var $=W++;R[$]==null&&(R[$]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
"line"),o==0&&R[$].setAttribute("shape-rendering","crispEdges"));T=R[$];T.setAttribute("x1",M.positionScreen.x);T.setAttribute("y1",M.positionScreen.y);T.setAttribute("x2",D.positionScreen.x);T.setAttribute("y2",D.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(T.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),t.appendChild(T))}}}else if(K instanceof
|
|
|
THREE.RenderableFace3){if(p=K.v1,y=K.v2,z=K.v3,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,z.positionScreen.x*=v,z.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(E)){w=0;for(H=K.meshMaterials.length;w<H;)if(U=K.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){M=0;for(D=K.faceMaterials.length;M<D;)(U=K.faceMaterials[M++])&&
|
|
|
U.opacity!=0&&c(p,y,z,K,U,b)}else U&&U.opacity!=0&&c(p,y,z,K,U,b)}}else if(K instanceof THREE.RenderableFace4&&(p=K.v1,y=K.v2,z=K.v3,A=K.v4,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,z.positionScreen.x*=v,z.positionScreen.y*=-x,A.positionScreen.x*=v,A.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),
|
|
@@ -229,13 +229,13 @@ THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.len
|
|
|
k.z;for(f=0;f<p;f++)h=f*3,color=v[w[f][1]],t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(y)for(ga in y){f=y[ga];v=f.value.length;for(h=0;h<v;h++){index=w[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")O=f.value[index];f.size===2?(f.array[p]=O.x,f.array[p+1]=O.y):f.size===3?f.type==="c"?(f.array[p]=O.r,f.array[p+1]=O.g,f.array[p+2]=O.b):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z):(f.array[p]=
|
|
|
O.x,f.array[p+1]=O.y,f.array[p+2]=O.z,f.array[p+3]=O.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(L)for(f=0;f<p;f++)color=v[f],h=f*3,t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(y)for(ga in y)if(f=y[ga],f.__original.needsUpdate){v=f.value.length;for(h=0;h<v;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")O=f.value[h];f.size===2?(f.array[p]=
|
|
|
O.x,f.array[p+1]=O.y):f.size===3?f.type==="c"?(f.array[p]=O.r,f.array[p+1]=O.g,f.array[p+2]=O.b):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z,f.array[p+3]=O.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,t,e);if(y)for(ga in y)if(f=y[ga],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||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 h=f.program,m=h.uniforms,n=f.uniforms;h!=S&&(o.useProgram(h),S=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ua);if(c&&f.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,
|
|
|
+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 h=f.program,m=h.uniforms,n=f.uniforms;h!=S&&(o.useProgram(h),S=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ua);if(c&&f.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,
|
|
|
n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var p,v,u,t=0,w=0,x=0,L,y,ga,O=Ca,z=O.directional.colors,A=O.directional.positions,C=O.point.colors,E=O.point.positions,G=O.point.distances,H=0,aa=0,c=v=ga=0;for(p=e.length;c<p;c++)if(v=e[c],u=v.color,L=v.position,y=v.intensity,ga=v.distance,v instanceof THREE.AmbientLight)t+=u.r,w+=u.g,x+=u.b;else if(v instanceof THREE.DirectionalLight)ga=
|
|
|
H*3,z[ga]=u.r*y,z[ga+1]=u.g*y,z[ga+2]=u.b*y,A[ga]=L.x,A[ga+1]=L.y,A[ga+2]=L.z,H+=1;else if(v instanceof THREE.SpotLight)ga=H*3,z[ga]=u.r*y,z[ga+1]=u.g*y,z[ga+2]=u.b*y,u=1/L.length(),A[ga]=L.x*u,A[ga+1]=L.y*u,A[ga+2]=L.z*u,H+=1;else if(v instanceof THREE.PointLight)v=aa*3,C[v]=u.r*y,C[v+1]=u.g*y,C[v+2]=u.b*y,E[v]=L.x,E[v+1]=L.y,E[v+2]=L.z,G[aa]=ga,aa+=1;for(c=H*3;c<z.length;c++)z[c]=0;for(c=aa*3;c<C.length;c++)C[c]=0;O.point.length=aa;O.directional.length=H;O.ambient[0]=t;O.ambient[1]=w;O.ambient[2]=
|
|
|
x;e=Ca;n.enableLighting.value=e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,
|
|
|
(n.map.texture=f.map)&&n.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),n.lightMap.texture=f.lightMap,n.envMap.texture=f.envMap,n.reflectivity.value=f.reflectivity,n.refractionRatio.value=f.refractionRatio,n.combine.value=f.combine,n.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)n.psColor.value=
|
|
|
f.color,n.opacity.value=f.opacity,n.size.value=f.size,n.scale.value=va.height/2,n.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)n.ambient.value=f.ambient,n.specular.value=f.specular,n.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)n.mNear.value=b.near,n.mFar.value=b.far,n.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<ka.length;e++)n.shadowMatrix.value[e]=
|
|
|
-ka[e],n.shadowMap.texture[e]=X.shadowMap[e];n.shadowDarkness.value=X.shadowMapDarkness;n.shadowBias.value=X.shadowMapBias}for(var N in n)if(p=h.uniforms[N])if(c=n[N],t=c.type,e=c.value,t=="i")o.uniform1i(p,e);else if(t=="f")o.uniform1f(p,e);else if(t=="v2")o.uniform2f(p,e.x,e.y);else if(t=="v3")o.uniform3f(p,e.x,e.y,e.z);else if(t=="v4")o.uniform4f(p,e.x,e.y,e.z,e.w);else if(t=="c")o.uniform3f(p,e.r,e.g,e.b);else if(t=="fv1")o.uniform1fv(p,e);else if(t=="fv")o.uniform3fv(p,e);else if(t=="v3v"){if(!c._array)c._array=
|
|
|
+ka[e],n.shadowMap.texture[e]=W.shadowMap[e];n.shadowDarkness.value=W.shadowMapDarkness;n.shadowBias.value=W.shadowMapBias}for(var N in n)if(p=h.uniforms[N])if(c=n[N],t=c.type,e=c.value,t=="i")o.uniform1i(p,e);else if(t=="f")o.uniform1f(p,e);else if(t=="v2")o.uniform2f(p,e.x,e.y);else if(t=="v3")o.uniform3f(p,e.x,e.y,e.z);else if(t=="v4")o.uniform4f(p,e.x,e.y,e.z,e.w);else if(t=="c")o.uniform3f(p,e.r,e.g,e.b);else if(t=="fv1")o.uniform1fv(p,e);else if(t=="fv")o.uniform3fv(p,e);else if(t=="v3v"){if(!c._array)c._array=
|
|
|
new Float32Array(3*e.length);t=0;for(w=e.length;t<w;t++)x=t*3,c._array[x]=e[t].x,c._array[x+1]=e[t].y,c._array[x+2]=e[t].z;o.uniform3fv(p,c._array)}else if(t=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(p,!1,c._array)}else if(t=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);t=0;for(w=e.length;t<w;t++)e[t].flattenToArrayOffset(c._array,t*16);o.uniformMatrix4fv(p,!1,c._array)}else if(t=="t"){if(o.uniform1i(p,e),p=c.texture)if(p.image instanceof
|
|
|
Array&&p.image.length==6){if(c=p,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);I(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else p instanceof
|
|
|
THREE.WebGLRenderTargetCube?(c=p,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(p,e)}else if(t=="tv"){if(!c._array){c._array=[];t=0;for(w=c.texture.length;t<w;t++)c._array[t]=e+t}o.uniform1iv(p,c._array);t=0;for(w=c.texture.length;t<w;t++)(p=c.texture[t])&&K(p,c._array[t])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||
|
|
@@ -246,16 +246,16 @@ f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.
|
|
|
o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.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),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(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==
|
|
|
+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,b.__webglNormalBuffer);if(c==
|
|
|
THREE.FlatShading){var f,h,k,m,n,p,v,t,u,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],t=c[w+5],n=c[w+6],v=c[w+7],u=c[w+8],f=(f+m+n)/3,h=(h+p+v)/3,k=(k+t+u)/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 m(b){if(ca!=
|
|
|
b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ca=b.doubleSided;if(ra!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ra=b.flipSided}function k(b){pa!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),pa=b)}function n(b){fa!=b&&(o.depthMask(b),fa=b)}function t(b,e,c){ia!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ia=b);if(b&&(U!=e||$!=c))o.polygonOffset(e,c),U=e,$=c}function u(b){ea[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
|
b.n14);ea[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ea[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ea[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ea[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ea[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=ea[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=ea[f].x*e.n14+ea[f].y*e.n24+ea[f].z*e.n34+ea[f].w,b<=c)return!1;return!0}function v(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?v(k,c):v(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?v(o,h):v(n,h))}else(h=e)&&(h.transparent?v(o,h):v(n,h))}function y(b,e){return e.z-b.z}function z(b,c){var n,p,v,t=0,x,L,y,z,A=b.lights;aa||(aa=new THREE.Camera(X.shadowCameraFov,c.aspect,X.shadowCameraNear,X.shadowCameraFar));n=0;for(p=A.length;n<p;n++)if(v=A[n],v instanceof THREE.SpotLight&&v.castShadow){X.shadowMap[t]||(X.shadowMap[t]=new THREE.WebGLRenderTarget(X.shadowMapWidth,X.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
-format:THREE.RGBAFormat}));ka[t]||(ka[t]=new THREE.Matrix4);x=X.shadowMap[t];L=ka[t];aa.position.copy(v.position);aa.target.position.copy(v.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);L.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);L.multiplySelf(aa.projectionMatrix);L.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(ta);aa.projectionMatrix.flattenToArray(ua);qa.multiply(aa.projectionMatrix,aa.matrixWorldInverse);u(qa);X.initWebGLObjects(b);W(x);o.clearColor(1,
|
|
|
-1,1,1);X.clear();o.clearColor(O.r,O.g,O.b,ga);L=b.__webglObjects.length;v=b.__webglObjectsImmediate.length;for(x=0;x<L;x++)y=b.__webglObjects[x],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,aa,!1),y.render=!0):y.render=!1:y.render=!1;k(!0);J(THREE.NormalBlending);for(x=0;x<L;x++)if(y=b.__webglObjects[x],y.render)z=y.object,buffer=y.buffer,m(z),y=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?
|
|
|
-xa:za,f(aa,A,null,y,buffer,z);for(x=0;x<v;x++)y=b.__webglObjectsImmediate[x],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,aa,!1),m(z),program=e(aa,A,null,za,z),z.render(function(b){h(b,program,za.shading)}));t++}}function A(b,e){var c,f,h;c=Z.attributes;var k=Z.uniforms,m=N/sa,n,p=[],v=sa*0.5,t=N*0.5,u=!0;o.useProgram(Z.program);S=Z.program;pa=la=-1;Fa||(o.enableVertexAttribArray(Z.attributes.position),o.enableVertexAttribArray(Z.attributes.uv),
|
|
|
+c;e++)(h=m.materials[e])&&(h.transparent?v(o,h):v(n,h))}else(h=e)&&(h.transparent?v(o,h):v(n,h))}function y(b,e){return e.z-b.z}function z(b){var c,n,p,v=0,t,x,L,y,z=b.lights;aa||(aa=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(p=z[c],p instanceof THREE.SpotLight&&p.castShadow){W.shadowMap[v]||(W.shadowMap[v]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
+format:THREE.RGBAFormat}));ka[v]||(ka[v]=new THREE.Matrix4);t=W.shadowMap[v];x=ka[v];aa.position.copy(p.position);aa.target.position.copy(p.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);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(aa.projectionMatrix);x.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(ta);aa.projectionMatrix.flattenToArray(ua);qa.multiply(aa.projectionMatrix,aa.matrixWorldInverse);u(qa);W.initWebGLObjects(b);X(t);o.clearColor(1,
|
|
|
+1,1,1);W.clear();o.clearColor(O.r,O.g,O.b,ga);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(t=0;t<x;t++)L=b.__webglObjects[t],y=L.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||w(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),C(y,aa,!1),L.render=!0):L.render=!1:L.render=!1;k(!0);J(THREE.NormalBlending);for(t=0;t<x;t++)if(L=b.__webglObjects[t],L.render)y=L.object,buffer=L.buffer,m(y),L=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?
|
|
|
+xa:za,f(aa,z,null,L,buffer,y);for(t=0;t<p;t++)L=b.__webglObjectsImmediate[t],y=L.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),C(y,aa,!1),m(y),program=e(aa,z,null,za,y),y.render(function(b){h(b,program,za.shading)}));v++}}function A(b,e){var c,f,h;c=Z.attributes;var k=Z.uniforms,m=N/sa,n,p=[],v=sa*0.5,t=N*0.5,u=!0;o.useProgram(Z.program);S=Z.program;pa=la=-1;Fa||(o.enableVertexAttribArray(Z.attributes.position),o.enableVertexAttribArray(Z.attributes.uv),
|
|
|
Fa=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,Z.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,Z.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,ua);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],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.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-v)/v,(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?N: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.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,
|
|
@@ -264,15 +264,15 @@ h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].ne
|
|
|
p=v[o].hash+"_"+v[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&&(v[o].counter+=1,p=v[o].hash+"_"+v[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 u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}
|
|
|
function Q(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=la){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)}la=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,V(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,T(e.magFilter)),
|
|
|
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(e.minFilter)))}function K(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,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=
|
|
|
-!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(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);I(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),
|
|
|
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(e.minFilter)))}function K(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,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=
|
|
|
+!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function X(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);I(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,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(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=sa,b=N,f=da,h=ja);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function D(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 T(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(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 X=this,o,ha=[],S=null,ma=null,ca=null,ra=null,la=null,pa=null,fa=null,ia=null,U=null,$=null,da=0,ja=0,sa=0,N=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),ta=new Float32Array(16),Ba=new THREE.Vector4,Ca=
|
|
|
+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,ha=[],S=null,ma=null,ca=null,ra=null,la=null,pa=null,fa=null,ia=null,U=null,$=null,da=0,ja=0,sa=0,N=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),ta=new Float32Array(16),Ba=new THREE.Vector4,Ca=
|
|
|
{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,O=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ga=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=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=va;this.sortObjects=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 aa,ka=[],b=THREE.ShaderLib.depthRGBA,oa=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
|
|
|
vertexShader:b.vertexShader,uniforms:oa}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:oa,morphTargets:!0});za._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))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(na){console.error(na)}o.clearColor(0,
|
|
@@ -283,8 +283,8 @@ o.bufferData(o.ELEMENT_ARRAY_BUFFER,Z.faces,o.STATIC_DRAW);Z.program=o.createPro
|
|
|
o.getUniformLocation(Z.program,"screenPosition");Z.uniforms.modelViewMatrix=o.getUniformLocation(Z.program,"modelViewMatrix");Z.uniforms.projectionMatrix=o.getUniformLocation(Z.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){da=b;ja=e;sa=c;N=f;o.viewport(da,ja,sa,N)};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){O.setHex(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.setClearColor=function(b,e){O.copy(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ga};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};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]);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;b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof THREE.MeshBasicMaterial?m="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]);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;b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof THREE.MeshBasicMaterial?m="basic":
|
|
|
b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var p,v,t;p=t=n=0;for(v=e.length;p<v;p++)k=e[p],k instanceof THREE.SpotLight&&t++,k instanceof THREE.DirectionalLight&&t++,k instanceof THREE.PointLight&&
|
|
|
n++;n+t<=_maxLights?p=t:(p=Math.ceil(_maxLights*t/(n+t)),n=_maxLights-p);k={directional:p,point:n};n=t=0;for(p=e.length;n<p;n++)v=e[n],v instanceof THREE.SpotLight&&v.castShadow&&t++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var w;a:{p=b.fragmentShader;v=b.vertexShader;var n=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:k.directional,maxPointLights:k.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:t,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(p),f.push(v));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=ha.length;x<f;x++)if(ha[x].code==m){w=ha[x].program;break a}x=o.createProgram();f=[ya?"#define VERTEX_TEXTURES":
|
|
@@ -293,35 +293,35 @@ maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k
|
|
|
k=["#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(x,R("fragment",k+p));o.attachShader(x,R("vertex",f+v));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
o.getError()+"]");x.uniforms={};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)p=L[f],x.uniforms[p]=o.getUniformLocation(x,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(w in e)f.push(w);
|
|
|
-w=f;L=0;for(e=w.length;L<e;L++)c=w[L],x.attributes[c]=o.getAttribLocation(x,c);ha.push({program:x,code:m});X.info.memory.programs=ha.length;w=x}b.program=w;w=b.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),
|
|
|
-o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,w[L]>=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);
|
|
|
-o.clear(b)};this.render=function(b,c,o,v){var L,ga,O,E,G,H,aa,N,I=b.lights,oa=b.fog;this.shadowMapEnabled&&z(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(ta);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(qa);this.initWebGLObjects(b);W(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v<G;v++)if(L=b.__webglObjects[v],
|
|
|
+w=f;L=0;for(e=w.length;L<e;L++)c=w[L],x.attributes[c]=o.getAttribLocation(x,c);ha.push({program:x,code:m});W.info.memory.programs=ha.length;w=x}b.program=w;w=b.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),
|
|
|
+o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,w[L]>=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){X(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);
|
|
|
+o.clear(b)};this.render=function(b,c,o,v){var L,ga,O,E,G,H,aa,N,I=b.lights,oa=b.fog;this.shadowMapEnabled&&z(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(ta);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(qa);this.initWebGLObjects(b);X(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v<G;v++)if(L=b.__webglObjects[v],
|
|
|
aa=L.object,aa.visible)if(!(aa instanceof THREE.Mesh)||!aa.frustumCulled||w(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),C(aa,c,!0),p(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(Ba.copy(aa.position),qa.multiplyVector3(Ba),L.z=Ba.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(y);H=b.__webglObjectsImmediate.length;for(v=0;v<H;v++)L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),
|
|
|
C(aa,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(v=0;v<G;v++)if(L=b.__webglObjects[v],L.render)aa=L.object,N=L.buffer,m(aa),f(c,I,oa,b.overrideMaterial,N,aa);for(v=0;v<H;v++)L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible&&(m(aa),ga=e(c,I,oa,b.overrideMaterial,aa),aa.render(function(c){h(c,ga,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(v=G-1;v>=0;v--)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;O=L.opaque;
|
|
|
m(aa);for(L=0;L<O.count;L++)E=O.list[L],k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,I,oa,E,N,aa)}for(v=0;v<H;v++)if(L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible){O=L.opaque;m(aa);for(L=0;L<O.count;L++)E=O.list[L],k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ga=e(c,I,oa,E,aa),aa.render(function(b){h(b,ga,E.shading)})}for(v=0;v<G;v++)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;
|
|
|
O=L.transparent;m(aa);for(L=0;L<O.count;L++)E=O.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,I,oa,E,N,aa)}for(v=0;v<H;v++)if(L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible){O=L.transparent;m(aa);for(L=0;L<O.count;L++)E=O.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ga=e(c,I,oa,E,aa),aa.render(function(b){h(b,ga,E.shading)})}}b.__webglSprites.length&&
|
|
|
A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&D(o)};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&&M(k),k.geometryGroups){m=k.geometryGroups[h];if(!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 v=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}X.info.memory.geometries++;for(var n=m,v=e,t=void 0,u=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,ga=y=p=0,O=w=u=void 0,z=O=u=t=void 0,w=void 0,x=v.geometry,L=x.faces,O=n.faces,t=0,u=O.length;t<u;t++)w=O[t],w=L[w],w instanceof
|
|
|
+n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var v=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=m,v=e,t=void 0,u=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,ga=y=p=0,O=w=u=void 0,z=O=u=t=void 0,w=void 0,x=v.geometry,L=x.faces,O=n.faces,t=0,u=O.length;t<u;t++)w=O[t],w=L[w],w instanceof
|
|
|
THREE.Face3?(p+=3,y+=1,ga+=3):w instanceof THREE.Face4&&(p+=4,y+=2,ga+=4);for(var t=n,u=v,A=O=L=void 0,C=void 0,A=void 0,w=[],L=0,O=u.materials.length;L<O;L++)if(A=u.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<l;A++)(C=t.materials[A])&&w.push(C)}else(C=A)&&w.push(C);t=w;n.__materials=t;a:{L=u=void 0;O=t.length;for(u=0;u<O;u++)if(L=t[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{O=L=void 0;w=t.length;for(L=0;L<w;L++)if(O=t[L],!(O instanceof
|
|
|
THREE.MeshBasicMaterial&&!O.envMap||O instanceof THREE.MeshDepthMaterial)){O=O&&O.shading!=void 0&&O.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}O=!1}a:{w=L=void 0;A=t.length;for(L=0;L<A;L++)if(w=t[L],w.vertexColors){w=w.vertexColors;break a}w=!1}n.__vertexArray=new Float32Array(p*3);if(O)n.__normalArray=new Float32Array(p*3);if(x.hasTangents)n.__tangentArray=new Float32Array(p*4);if(w)n.__colorArray=new Float32Array(p*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>
|
|
|
0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ga*2);if(n.numMorphTargets){n.__morphTargetsArrays=
|
|
|
[];x=0;for(L=n.numMorphTargets;x<L;x++)n.__morphTargetsArrays.push(new Float32Array(p*3))}n.__needsSmoothNormals=O==THREE.SmoothShading;n.__uvType=u;n.__vertexColorType=w;n.__normalType=O;n.__webglFaceCount=y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0);n.__webglLineCount=ga*2;x=0;for(L=t.length;x<L;x++)if(u=t[x],u.attributes){if(n.__webglCustomAttributes===void 0)n.__webglCustomAttributes={};for(a in u.attributes){w=u.attributes[a];O={};for(z in w)O[z]=w[z];if(!O.__webglInitialized||
|
|
|
O.createUniqueBuffers)O.__webglInitialized=!0,y=1,O.type==="v2"?y=2:O.type==="v3"?y=3:O.type==="v4"?y=4:O.type==="c"&&(y=3),O.size=y,O.array=new Float32Array(p*y),O.buffer=o.createBuffer(),O.buffer.belongsToAttribute=a,w.needsUpdate=!0,O.__original=w;n.__webglCustomAttributes[a]=O}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}Q(f.__webglObjects,m,e)}else if(e instanceof THREE.Ribbon){k=
|
|
|
-e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglVertexCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;Q(f.__webglObjects,k,e)}else if(e instanceof THREE.Line){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,
|
|
|
-h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglLineCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;Q(f.__webglObjects,k,e)}else if(e instanceof THREE.ParticleSystem){k=e.geometry;if(!k.__webglVertexBuffer){h=k;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();X.info.geometries++;h=k;m=e;n=h.vertices.length;h.__vertexArray=new Float32Array(n*3);h.__colorArray=new Float32Array(n*3);h.__sortArray=[];h.__webglParticleCount=
|
|
|
+e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglVertexCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;Q(f.__webglObjects,k,e)}else if(e instanceof THREE.Line){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,
|
|
|
+h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglLineCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;Q(f.__webglObjects,k,e)}else if(e instanceof THREE.ParticleSystem){k=e.geometry;if(!k.__webglVertexBuffer){h=k;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();W.info.geometries++;h=k;m=e;n=h.vertices.length;h.__vertexArray=new Float32Array(n*3);h.__colorArray=new Float32Array(n*3);h.__sortArray=[];h.__webglParticleCount=
|
|
|
n;h.__materials=m.materials;z=p=v=void 0;v=0;for(p=m.materials.length;v<p;v++)if(z=m.materials[v],z.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.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(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}Q(f.__webglObjects,k,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)H(e.__webglObjects,f);else if(f instanceof THREE.Sprite){e=e.__webglSprites;k=void 0;for(k=e.length-1;k>=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=
|
|
|
0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,p=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(v=k.geometryGroupsList.length;n<v;n++)if(m=k.geometryGroupsList[n],p=E(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||p)if(p=m,z=o.DYNAMIC_DRAW,y=!k.dynamic,p.__inittedArrays){var aa=x=ga=void 0,N=void 0,I=aa=void 0,oa=void 0,K=void 0,ea=void 0,ka=C=A=w=O=L=u=t=void 0,J=void 0,F=N=ea=
|
|
|
-N=K=oa=void 0,B=void 0,D=B=F=oa=void 0,Z=void 0,$=D=B=F=aa=aa=I=ea=N=D=B=F=Z=D=B=F=Z=D=B=F=void 0,U=0,qa=0,R=0,ua=0,za=0,S=0,na=0,T=0,W=0,P=0,da=0,D=F=0,D=void 0,V=p.__vertexArray,la=p.__uvArray,ra=p.__uv2Array,ia=p.__normalArray,ja=p.__tangentArray,xa=p.__colorArray,ca=p.__skinVertexAArray,ta=p.__skinVertexBArray,fa=p.__skinIndexArray,ha=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributes,B=void 0,ma=p.__faceArray,ya=p.__lineArray,Ba=p.__needsSmoothNormals,u=p.__vertexColorType,
|
|
|
+N=K=oa=void 0,B=void 0,D=B=F=oa=void 0,Z=void 0,$=D=B=F=aa=aa=I=ea=N=D=B=F=Z=D=B=F=Z=D=B=F=void 0,U=0,qa=0,R=0,ua=0,za=0,S=0,na=0,T=0,X=0,P=0,da=0,D=F=0,D=void 0,V=p.__vertexArray,la=p.__uvArray,ra=p.__uv2Array,ia=p.__normalArray,ja=p.__tangentArray,xa=p.__colorArray,ca=p.__skinVertexAArray,ta=p.__skinVertexBArray,fa=p.__skinIndexArray,ha=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributes,B=void 0,ma=p.__faceArray,ya=p.__lineArray,Ba=p.__needsSmoothNormals,u=p.__vertexColorType,
|
|
|
t=p.__uvType,L=p.__normalType,va=h.geometry,Ca=va.__dirtyVertices,Fa=va.__dirtyElements,Aa=va.__dirtyUvs,Ea=va.__dirtyNormals,ab=va.__dirtyTangents,bb=va.__dirtyColors,cb=va.__dirtyMorphTargets,Oa=va.vertices,eb=p.faces,hb=va.faces,fb=va.faceVertexUvs[0],gb=va.faceVertexUvs[1],Pa=va.skinVerticesA,Qa=va.skinVerticesB,Ra=va.skinIndices,Ha=va.skinWeights,Ga=va.morphTargets;if(sa)for($ in sa)sa[$].offset=0,sa[$].offsetSrc=0;ga=0;for(x=eb.length;ga<x;ga++)if(aa=eb[ga],N=hb[aa],fb&&(O=fb[aa]),gb&&(w=gb[aa]),
|
|
|
aa=N.vertexNormals,I=N.normal,oa=N.vertexColors,K=N.color,ea=N.vertexTangents,N instanceof THREE.Face3){if(Ca)A=Oa[N.a].position,C=Oa[N.b].position,ka=Oa[N.c].position,V[qa]=A.x,V[qa+1]=A.y,V[qa+2]=A.z,V[qa+3]=C.x,V[qa+4]=C.y,V[qa+5]=C.z,V[qa+6]=ka.x,V[qa+7]=ka.y,V[qa+8]=ka.z,qa+=9;if(sa)for($ in sa)if(B=sa[$],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[N.a],B.array[F+1]=B.value[N.b],B.array[F+2]=B.value[N.c]):B.boundTo===
|
|
|
"faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+2]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[N.a],C=B.value[N.b],ka=B.value[N.c]):B.boundTo==="faces"?(ka=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ka=B.value[D+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+
|
|
|
2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ka.x,B.array[F+5]=ka.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ka.r,B.array[F+7]=ka.g,B.array[F+8]=ka.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ka.x,B.array[F+7]=ka.y,B.array[F+8]=ka.z),B.offset+=9):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=
|
|
|
C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ka.x,B.array[F+9]=ka.y,B.array[F+10]=ka.z,B.array[F+11]=ka.w,B.offset+=12));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[N.a].position,C=Ga[F].vertices[N.b].position,ka=Ga[F].vertices[N.c].position,D=pa[F],D[da]=A.x,D[da+1]=A.y,D[da+2]=A.z,D[da+3]=C.x,D[da+4]=C.y,D[da+5]=C.z,D[da+6]=ka.x,D[da+7]=ka.y,D[da+8]=ka.z;da+=9}if(Ha.length)F=Ha[N.a],B=Ha[N.b],D=Ha[N.c],ha[P]=F.x,ha[P+1]=F.y,ha[P+2]=F.z,ha[P+3]=F.w,ha[P+4]=B.x,ha[P+
|
|
|
5]=B.y,ha[P+6]=B.z,ha[P+7]=B.w,ha[P+8]=D.x,ha[P+9]=D.y,ha[P+10]=D.z,ha[P+11]=D.w,F=Ra[N.a],B=Ra[N.b],D=Ra[N.c],fa[P]=F.x,fa[P+1]=F.y,fa[P+2]=F.z,fa[P+3]=F.w,fa[P+4]=B.x,fa[P+5]=B.y,fa[P+6]=B.z,fa[P+7]=B.w,fa[P+8]=D.x,fa[P+9]=D.y,fa[P+10]=D.z,fa[P+11]=D.w,F=Pa[N.a],B=Pa[N.b],D=Pa[N.c],ca[P]=F.x,ca[P+1]=F.y,ca[P+2]=F.z,ca[P+3]=1,ca[P+4]=B.x,ca[P+5]=B.y,ca[P+6]=B.z,ca[P+7]=1,ca[P+8]=D.x,ca[P+9]=D.y,ca[P+10]=D.z,ca[P+11]=1,F=Qa[N.a],B=Qa[N.b],D=Qa[N.c],ta[P]=F.x,ta[P+1]=F.y,ta[P+2]=F.z,ta[P+3]=1,ta[P+
|
|
|
-4]=B.x,ta[P+5]=B.y,ta[P+6]=B.z,ta[P+7]=1,ta[P+8]=D.x,ta[P+9]=D.y,ta[P+10]=D.z,ta[P+11]=1,P+=12;if(bb&&u)oa.length==3&&u==THREE.VertexColors?(N=oa[0],F=oa[1],B=oa[2]):B=F=N=K,xa[W]=N.r,xa[W+1]=N.g,xa[W+2]=N.b,xa[W+3]=F.r,xa[W+4]=F.g,xa[W+5]=F.b,xa[W+6]=B.r,xa[W+7]=B.g,xa[W+8]=B.b,W+=9;if(ab&&va.hasTangents)oa=ea[0],K=ea[1],N=ea[2],ja[na]=oa.x,ja[na+1]=oa.y,ja[na+2]=oa.z,ja[na+3]=oa.w,ja[na+4]=K.x,ja[na+5]=K.y,ja[na+6]=K.z,ja[na+7]=K.w,ja[na+8]=N.x,ja[na+9]=N.y,ja[na+10]=N.z,ja[na+11]=N.w,na+=12;if(Ea&&
|
|
|
+4]=B.x,ta[P+5]=B.y,ta[P+6]=B.z,ta[P+7]=1,ta[P+8]=D.x,ta[P+9]=D.y,ta[P+10]=D.z,ta[P+11]=1,P+=12;if(bb&&u)oa.length==3&&u==THREE.VertexColors?(N=oa[0],F=oa[1],B=oa[2]):B=F=N=K,xa[X]=N.r,xa[X+1]=N.g,xa[X+2]=N.b,xa[X+3]=F.r,xa[X+4]=F.g,xa[X+5]=F.b,xa[X+6]=B.r,xa[X+7]=B.g,xa[X+8]=B.b,X+=9;if(ab&&va.hasTangents)oa=ea[0],K=ea[1],N=ea[2],ja[na]=oa.x,ja[na+1]=oa.y,ja[na+2]=oa.z,ja[na+3]=oa.w,ja[na+4]=K.x,ja[na+5]=K.y,ja[na+6]=K.z,ja[na+7]=K.w,ja[na+8]=N.x,ja[na+9]=N.y,ja[na+10]=N.z,ja[na+11]=N.w,na+=12;if(Ea&&
|
|
|
L)if(aa.length==3&&Ba)for(ea=0;ea<3;ea++)I=aa[ea],ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;else for(ea=0;ea<3;ea++)ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;if(Aa&&O!==void 0&&t)for(ea=0;ea<3;ea++)aa=O[ea],la[R]=aa.u,la[R+1]=aa.v,R+=2;if(Aa&&w!==void 0&&t)for(ea=0;ea<3;ea++)aa=w[ea],ra[ua]=aa.u,ra[ua+1]=aa.v,ua+=2;Fa&&(ma[za]=U,ma[za+1]=U+1,ma[za+2]=U+2,za+=3,ya[T]=U,ya[T+1]=U+1,ya[T+2]=U,ya[T+3]=U+2,ya[T+4]=U+1,ya[T+5]=U+2,T+=6,U+=3)}else if(N instanceof THREE.Face4){if(Ca)A=Oa[N.a].position,C=Oa[N.b].position,
|
|
|
ka=Oa[N.c].position,J=Oa[N.d].position,V[qa]=A.x,V[qa+1]=A.y,V[qa+2]=A.z,V[qa+3]=C.x,V[qa+4]=C.y,V[qa+5]=C.z,V[qa+6]=ka.x,V[qa+7]=ka.y,V[qa+8]=ka.z,V[qa+9]=J.x,V[qa+10]=J.y,V[qa+11]=J.z,qa+=12;if(sa)for($ in sa)if(B=sa[$],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[N.a],B.array[F+1]=B.value[N.b],B.array[F+2]=B.value[N.c],B.array[F+3]=B.value[N.d]):B.boundTo==="faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+
|
|
|
2]=D,B.array[F+3]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.array[F+3]=B.value[D+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[N.a],C=B.value[N.b],ka=B.value[N.c],J=B.value[N.d]):B.boundTo==="faces"?(J=ka=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ka=B.value[D+2],J=B.value[D+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=
|
|
@@ -329,10 +329,10 @@ A.y,B.array[F+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ka.x,B.array[F+5]=ka.y,B.arra
|
|
|
8]=ka.z,B.array[F+9]=J.x,B.array[F+10]=J.y,B.array[F+11]=J.z),B.offset+=12):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ka.x,B.array[F+9]=ka.y,B.array[F+10]=ka.z,B.array[F+11]=ka.w,B.array[F+12]=J.x,B.array[F+13]=J.y,B.array[F+14]=J.z,B.array[F+15]=J.w,B.offset+=16));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[N.a].position,C=Ga[F].vertices[N.b].position,ka=Ga[F].vertices[N.c].position,
|
|
|
J=Ga[F].vertices[N.d].position,D=pa[F],D[da]=A.x,D[da+1]=A.y,D[da+2]=A.z,D[da+3]=C.x,D[da+4]=C.y,D[da+5]=C.z,D[da+6]=ka.x,D[da+7]=ka.y,D[da+8]=ka.z,D[da+9]=J.x,D[da+10]=J.y,D[da+11]=J.z;da+=12}if(Ha.length)F=Ha[N.a],B=Ha[N.b],D=Ha[N.c],Z=Ha[N.d],ha[P]=F.x,ha[P+1]=F.y,ha[P+2]=F.z,ha[P+3]=F.w,ha[P+4]=B.x,ha[P+5]=B.y,ha[P+6]=B.z,ha[P+7]=B.w,ha[P+8]=D.x,ha[P+9]=D.y,ha[P+10]=D.z,ha[P+11]=D.w,ha[P+12]=Z.x,ha[P+13]=Z.y,ha[P+14]=Z.z,ha[P+15]=Z.w,F=Ra[N.a],B=Ra[N.b],D=Ra[N.c],Z=Ra[N.d],fa[P]=F.x,fa[P+1]=F.y,
|
|
|
fa[P+2]=F.z,fa[P+3]=F.w,fa[P+4]=B.x,fa[P+5]=B.y,fa[P+6]=B.z,fa[P+7]=B.w,fa[P+8]=D.x,fa[P+9]=D.y,fa[P+10]=D.z,fa[P+11]=D.w,fa[P+12]=Z.x,fa[P+13]=Z.y,fa[P+14]=Z.z,fa[P+15]=Z.w,F=Pa[N.a],B=Pa[N.b],D=Pa[N.c],Z=Pa[N.d],ca[P]=F.x,ca[P+1]=F.y,ca[P+2]=F.z,ca[P+3]=1,ca[P+4]=B.x,ca[P+5]=B.y,ca[P+6]=B.z,ca[P+7]=1,ca[P+8]=D.x,ca[P+9]=D.y,ca[P+10]=D.z,ca[P+11]=1,ca[P+12]=Z.x,ca[P+13]=Z.y,ca[P+14]=Z.z,ca[P+15]=1,F=Qa[N.a],B=Qa[N.b],D=Qa[N.c],N=Qa[N.d],ta[P]=F.x,ta[P+1]=F.y,ta[P+2]=F.z,ta[P+3]=1,ta[P+4]=B.x,ta[P+
|
|
|
-5]=B.y,ta[P+6]=B.z,ta[P+7]=1,ta[P+8]=D.x,ta[P+9]=D.y,ta[P+10]=D.z,ta[P+11]=1,ta[P+12]=N.x,ta[P+13]=N.y,ta[P+14]=N.z,ta[P+15]=1,P+=16;if(bb&&u)oa.length==4&&u==THREE.VertexColors?(N=oa[0],F=oa[1],B=oa[2],oa=oa[3]):oa=B=F=N=K,xa[W]=N.r,xa[W+1]=N.g,xa[W+2]=N.b,xa[W+3]=F.r,xa[W+4]=F.g,xa[W+5]=F.b,xa[W+6]=B.r,xa[W+7]=B.g,xa[W+8]=B.b,xa[W+9]=oa.r,xa[W+10]=oa.g,xa[W+11]=oa.b,W+=12;if(ab&&va.hasTangents)oa=ea[0],K=ea[1],N=ea[2],ea=ea[3],ja[na]=oa.x,ja[na+1]=oa.y,ja[na+2]=oa.z,ja[na+3]=oa.w,ja[na+4]=K.x,ja[na+
|
|
|
+5]=B.y,ta[P+6]=B.z,ta[P+7]=1,ta[P+8]=D.x,ta[P+9]=D.y,ta[P+10]=D.z,ta[P+11]=1,ta[P+12]=N.x,ta[P+13]=N.y,ta[P+14]=N.z,ta[P+15]=1,P+=16;if(bb&&u)oa.length==4&&u==THREE.VertexColors?(N=oa[0],F=oa[1],B=oa[2],oa=oa[3]):oa=B=F=N=K,xa[X]=N.r,xa[X+1]=N.g,xa[X+2]=N.b,xa[X+3]=F.r,xa[X+4]=F.g,xa[X+5]=F.b,xa[X+6]=B.r,xa[X+7]=B.g,xa[X+8]=B.b,xa[X+9]=oa.r,xa[X+10]=oa.g,xa[X+11]=oa.b,X+=12;if(ab&&va.hasTangents)oa=ea[0],K=ea[1],N=ea[2],ea=ea[3],ja[na]=oa.x,ja[na+1]=oa.y,ja[na+2]=oa.z,ja[na+3]=oa.w,ja[na+4]=K.x,ja[na+
|
|
|
5]=K.y,ja[na+6]=K.z,ja[na+7]=K.w,ja[na+8]=N.x,ja[na+9]=N.y,ja[na+10]=N.z,ja[na+11]=N.w,ja[na+12]=ea.x,ja[na+13]=ea.y,ja[na+14]=ea.z,ja[na+15]=ea.w,na+=16;if(Ea&&L)if(aa.length==4&&Ba)for(ea=0;ea<4;ea++)I=aa[ea],ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;else for(ea=0;ea<4;ea++)ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;if(Aa&&O!==void 0&&t)for(ea=0;ea<4;ea++)aa=O[ea],la[R]=aa.u,la[R+1]=aa.v,R+=2;if(Aa&&w!==void 0&&t)for(ea=0;ea<4;ea++)aa=w[ea],ra[ua]=aa.u,ra[ua+1]=aa.v,ua+=2;Fa&&(ma[za]=U,ma[za+1]=U+1,ma[za+
|
|
|
2]=U+3,ma[za+3]=U+1,ma[za+4]=U+2,ma[za+5]=U+3,za+=6,ya[T]=U,ya[T+1]=U+1,ya[T+2]=U,ya[T+3]=U+3,ya[T+4]=U+1,ya[T+5]=U+2,ya[T+6]=U+2,ya[T+7]=U+3,T+=8,U+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,z));if(sa)for($ in sa)B=sa[$],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,B.array,z));if(cb){F=0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,pa[F],
|
|
|
-z)}bb&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ra,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
|
|
|
+z)}bb&&X>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ra,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
|
|
|
p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ta,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
ha,z));y&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=
|
|
|
h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ga=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<t;y++)ga=x[y].position,n=y*3,u[n]=ga.x,u[n+1]=ga.y,u[n+2]=ga.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,u,m)}if(L){for(y=0;y<p;y++)color=v[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
@@ -428,7 +428,7 @@ this.getPrevKeyWith("pos",p,k.index-1).pos,this.points[1]=h,this.points[2]=m,thi
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,m,k,n,t,u;h=(b.length-1)*c;m=Math.floor(h);h-=m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>b.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];t=b[e[2]];u=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],t[0],u[0],h,e,k);f[1]=this.interpolate(m[1],n[1],t[1],u[1],h,e,k);f[2]=this.interpolate(m[2],n[2],t[2],u[2],h,e,k);return f};
|
|
|
THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
|
|
|
-THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
|
+THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
|
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
|
|
|
void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
|
|
|
b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
|
|
@@ -440,7 +440,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen
|
|
|
THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
|
THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),t=m.length,E=0;k=t-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<t-1;k++)E=f*n.chunks[k]/n.total,e.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
|
f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
|
|
|
-16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
|
|
|
+16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
|
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,m=Math.PI/180;this.update=function(b,e,c){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*m;this.theta=this.lon*m;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var n=k[1]-k[0];this.phi=
|
|
@@ -448,7 +448,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k
|
|
|
b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),t=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(t,k);b.position.set(0,10,0);this.animation=
|
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
|
|
|
!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
-THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
|
+THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
|
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
|
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
|
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
@@ -476,8 +476,8 @@ c(this,function(b){e&&(m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=
|
|
|
b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=t=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(u=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.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,t){function u(b,c,e,k,n,p,t,v){var u,x,y=f||1,z=h||1,R=n/2,T=p/2,V=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",z=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",y=m||1;var X=y+1,o=z+1;n/=y;var ha=p/z;for(x=0;x<o;x++)for(p=0;p<X;p++){var S=new THREE.Vector3;S[b]=(p*n-R)*e;S[c]=(x*ha-T)*k;S[u]=t;w.vertices.push(new THREE.Vertex(S))}for(x=0;x<z;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+X*
|
|
|
-x+V,p+X*(x+1)+V,p+1+X*(x+1)+V,p+1+X*x+V,null,null,v)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,v=b/2,x=c/2,p=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var z in t)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,t){function u(b,c,e,k,n,p,t,v){var u,x,y=f||1,z=h||1,R=n/2,T=p/2,V=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",z=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",y=m||1;var W=y+1,o=z+1;n/=y;var ha=p/z;for(x=0;x<o;x++)for(p=0;p<W;p++){var S=new THREE.Vector3;S[b]=(p*n-R)*e;S[c]=(x*ha-T)*k;S[u]=t;w.vertices.push(new THREE.Vertex(S))}for(x=0;x<z;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+W*
|
|
|
+x+V,p+W*(x+1)+V,p+1+W*(x+1)+V,p+1+W*x+V,null,null,v)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,v=b/2,x=c/2,p=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var z in t)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
t[z]);this.sides.px&&u("z","y",1*n,-1,e,c,-v,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,v,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,p,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-p,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=w.vertices.length;e<f;e++){for(var h=w.vertices[e],k=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(h.position.x==p.position.x&&
|
|
|
h.position.y==p.position.y&&h.position.z==p.position.z){c[e]=m;k=!0;break}}if(!k)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=w.faces.length;e<f;e++)h=w.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];w.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(b,c,e,f,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,t,u=[],w=[];for(t=0;t<=h;t++){var v=[],x=[],p=t/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-p*e+k,y*Math.cos(z*Math.PI*2))));v.push(this.vertices.length-1);x.push(new THREE.UV(z,p))}u.push(v);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=u[t][n],v=u[t+1][n],x=u[t+1][n+1],p=u[t][n+1],y=
|
|
@@ -487,17 +487,17 @@ H=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,v,x,[y,z,A])),this.faceV
|
|
|
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,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){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-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.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(c).addSelf(k);o.copy(e).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 c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){pa=D;fa=D-1;fa<0&&(fa=b.length-
|
|
|
-1);for(var c=0,e=p+w*2,c=0;c<e;c++){var f=ha*c,h=ha*(c+1),k=ia+pa+f,m=ia+pa+h,o=k,f=ia+fa+f,h=ia+fa+h,v=m;o+=W;f+=W;h+=W;v+=W;K.faces.push(new THREE.Face4(o,f,h,v,null,null,H));H&&(o=c/e,f=(c+1)/e,h=n+t*2,k=(K.vertices[k].position.z+t)/h,m=(K.vertices[m].position.z+t)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=W;c+=W;e+=W;K.faces.push(new THREE.Face3(b,
|
|
|
+1);for(var c=0,e=p+w*2,c=0;c<e;c++){var f=ha*c,h=ha*(c+1),k=ia+pa+f,m=ia+pa+h,o=k,f=ia+fa+f,h=ia+fa+h,v=m;o+=X;f+=X;h+=X;v+=X;K.faces.push(new THREE.Face4(o,f,h,v,null,null,H));H&&(o=c/e,f=(c+1)/e,h=n+t*2,k=(K.vertices[k].position.z+t)/h,m=(K.vertices[m].position.z+t)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=X;c+=X;e+=X;K.faces.push(new THREE.Face3(b,
|
|
|
c,e,null,null,G));if(G){var f=M.maxY,h=M.maxX,k=K.vertices[c].position.x,c=K.vertices[c].position.y,m=K.vertices[e].position.x,e=K.vertices[e].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/h,K.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,v=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,z=c.extrudePath,A,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,H=c.extrudeMaterial,M=this.shapebb;if(z)A=z.getPoints(x),p=A.length,C=!0,v=!1;v||(u=t=w=0);var Q,J,I,K=this,W=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(I=x.length;J<I;J++)Q=x[J],THREE.Shape.Utils.isClockWise(Q)&&
|
|
|
-(x[J]=Q.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(I=x.length;J<I;J++)Q=x[J],y=y.concat(Q);var D,R,T,V,X,o,ha=y.length,S=z.length,ma=[];D=0;R=E.length;pa=R-1;for(fa=D+1;D<R;D++,pa++,fa++)pa==R&&(pa=0),fa==R&&(fa=0),ma[D]=f(E[D],E[pa],E[fa]);var ca=[],ra,la=ma.concat();J=0;for(I=x.length;J<I;J++){Q=x[J];ra=[];D=0;R=Q.length;pa=R-1;for(fa=D+1;D<R;D++,pa++,fa++)pa==R&&(pa=0),fa==R&&(fa=0),ra[D]=f(Q[D],Q[pa],Q[fa]);ca.push(ra);la=la.concat(ra)}for(T=0;T<w;T++){V=T/w;X=t*(1-
|
|
|
-V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D<R;D++)o=e(E[D],ma[D],V),m(o.x,o.y,-X);J=0;for(I=x.length;J<I;J++){Q=x[J];ra=ca[J];D=0;for(R=Q.length;D<R;D++)o=e(Q[D],ra[D],V),m(o.x,o.y,-X)}}V=u;for(D=0;D<ha;D++)o=v?e(y[D],la[D],V):y[D],C?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(T=1;T<=p;T++)for(D=0;D<ha;D++)o=v?e(y[D],la[D],V):y[D],C?m(o.x,o.y+A[T-1].y,A[T-1].x):m(o.x,o.y,n/p*T);for(T=w-1;T>=0;T--){V=T/w;X=t*(1-V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D<R;D++)o=e(E[D],ma[D],V),m(o.x,o.y,
|
|
|
-n+X);J=0;for(I=x.length;J<I;J++){Q=x[J];ra=ca[J];D=0;for(R=Q.length;D<R;D++)o=e(Q[D],ra[D],V),C?m(o.x,o.y+A[p-1].y,A[p-1].x+X):m(o.x,o.y,n+X)}}if(v){v=ha*0;for(D=0;D<S;D++)u=z[D],k(u[2]+v,u[1]+v,u[0]+v);v=ha*(p+w*2);for(D=0;D<S;D++)u=z[D],k(u[0]+v,u[1]+v,u[2]+v)}else{for(D=0;D<S;D++)u=z[D],k(u[2],u[1],u[0]);for(D=0;D<S;D++)u=z[D],k(u[0]+ha*p,u[1]+ha*p,u[2]+ha*p)}var pa,fa,ia=0;h(E);ia+=E.length;J=0;for(I=x.length;J<I;J++)Q=x[J],h(Q),ia+=Q.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,z=c.extrudePath,A,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,H=c.extrudeMaterial,M=this.shapebb;if(z)A=z.getPoints(x),p=A.length,C=!0,v=!1;v||(u=t=w=0);var Q,J,I,K=this,X=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(I=x.length;J<I;J++)Q=x[J],THREE.Shape.Utils.isClockWise(Q)&&
|
|
|
+(x[J]=Q.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(I=x.length;J<I;J++)Q=x[J],y=y.concat(Q);var D,R,T,V,W,o,ha=y.length,S=z.length,ma=[];D=0;R=E.length;pa=R-1;for(fa=D+1;D<R;D++,pa++,fa++)pa==R&&(pa=0),fa==R&&(fa=0),ma[D]=f(E[D],E[pa],E[fa]);var ca=[],ra,la=ma.concat();J=0;for(I=x.length;J<I;J++){Q=x[J];ra=[];D=0;R=Q.length;pa=R-1;for(fa=D+1;D<R;D++,pa++,fa++)pa==R&&(pa=0),fa==R&&(fa=0),ra[D]=f(Q[D],Q[pa],Q[fa]);ca.push(ra);la=la.concat(ra)}for(T=0;T<w;T++){V=T/w;W=t*(1-
|
|
|
+V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D<R;D++)o=e(E[D],ma[D],V),m(o.x,o.y,-W);J=0;for(I=x.length;J<I;J++){Q=x[J];ra=ca[J];D=0;for(R=Q.length;D<R;D++)o=e(Q[D],ra[D],V),m(o.x,o.y,-W)}}V=u;for(D=0;D<ha;D++)o=v?e(y[D],la[D],V):y[D],C?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(T=1;T<=p;T++)for(D=0;D<ha;D++)o=v?e(y[D],la[D],V):y[D],C?m(o.x,o.y+A[T-1].y,A[T-1].x):m(o.x,o.y,n/p*T);for(T=w-1;T>=0;T--){V=T/w;W=t*(1-V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D<R;D++)o=e(E[D],ma[D],V),m(o.x,o.y,
|
|
|
+n+W);J=0;for(I=x.length;J<I;J++){Q=x[J];ra=ca[J];D=0;for(R=Q.length;D<R;D++)o=e(Q[D],ra[D],V),C?m(o.x,o.y+A[p-1].y,A[p-1].x+W):m(o.x,o.y,n+W)}}if(v){v=ha*0;for(D=0;D<S;D++)u=z[D],k(u[2]+v,u[1]+v,u[0]+v);v=ha*(p+w*2);for(D=0;D<S;D++)u=z[D],k(u[0]+v,u[1]+v,u[2]+v)}else{for(D=0;D<S;D++)u=z[D],k(u[2],u[1],u[0]);for(D=0;D<S;D++)u=z[D],k(u[0]+ha*p,u[1]+ha*p,u[2]+ha*p)}var pa,fa,ia=0;h(E);ia+=E.length;J=0;for(I=x.length;J<I;J++)Q=x[J],h(Q),ia+=Q.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,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}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,m=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,m);e(0,5,1,m);e(0,1,7,m);e(0,7,10,m);e(0,10,11,m);e(1,5,9,m);e(5,11,4,m);e(11,10,2,m);e(10,7,6,m);e(7,1,8,m);e(3,9,4,m);e(3,4,2,m);e(3,2,6,m);e(3,6,8,m);e(3,8,9,m);e(4,9,5,m);e(2,4,11,m);e(6,2,10,m);e(8,6,7,m);e(9,8,1,m);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in m.faces){var t=f(m.faces[n].a,m.faces[n].b),u=f(m.faces[n].b,m.faces[n].c),w=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,t,w,b);e(m.faces[n].b,u,
|
|
|
t,b);e(m.faces[n].c,w,u,b);e(t,u,w,b)}m.faces=b.faces}h.faces=m.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],m=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var t=0;t<=this.angle+0.001;t+=c){for(n=0;n<e.length;n++)t<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=m;t==0&&(m=f);
|
|
|
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],m=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var t=0;t<=this.angle+0.0010;t+=c){for(n=0;n<e.length;n++)t<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=m;t==0&&(m=f);
|
|
|
for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-t/this.angle,n/b.length),new THREE.UV(1-t/this.angle,(n+1)/b.length),new THREE.UV(1-(t-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(t-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,m=b/2,k=c/2,e=e||1,f=f||1,n=e+1,t=f+1;b/=e;var u=c/f;for(h=0;h<t;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-m,-(h*u-k),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
@@ -512,7 +512,7 @@ this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[
|
|
|
u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;m.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,u);if(k=m[m.length-1]){w=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var C=k/divisions,E=THREE.Shape.Utils.b2(C,w,x,n),C=THREE.Shape.Utils.b2(C,v,p,u);m.push(new THREE.Vector2(E,C))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,u,
|
|
|
x,p,y,z),k=m[m.length-1]){w=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)C=k/divisions,E=THREE.Shape.Utils.b3(C,w,x,y,n),C=THREE.Shape.Utils.b3(C,v,p,z,u),m.push(new THREE.Vector2(E,C))}}}return{offset:A.ha*e,points:m,path:h}}}};
|
|
|
(function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],t,u,w;if(c(b)>0)for(u=0;u<h;u++)k[u]=u;else for(u=0;u<h;u++)k[u]=h-1-u;var v=2*h;for(u=h-1;h>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=u,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0,
|
|
|
-M=void 0,Q=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[p]].x,H=x[C[p]].y,M=x[C[y]].x,Q=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(M-G)*(I-H)-(Q-H)*(J-G))x=!1;else{for(E=0;E<A;E++)if(!(E==p||E==y||E==z)){var K=x[C[E]].x,W=x[C[E]].y,D=void 0,R=void 0,T=void 0,V=void 0,X=void 0,o=void 0,ha=void 0,S=void 0,ma=void 0,ca=void 0,ra=void 0,la=void 0,D=T=X=void 0,D=J-M,R=I-Q,T=G-J,V=H-I,X=M-G,o=Q-H,ha=K-G,S=W-H,ma=K-M,ca=W-Q,ra=K-J,la=W-I,D=D*ca-R*ma,X=X*S-o*ha,T=T*la-V*ra;if(D>=0&&T>=0&&X>=0){x=!1;
|
|
|
+M=void 0,Q=void 0,J=void 0,I=void 0,K=void 0,X=void 0,G=x[C[p]].x,H=x[C[p]].y,M=x[C[y]].x,Q=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(M-G)*(I-H)-(Q-H)*(J-G))x=!1;else{for(E=0;E<A;E++)if(!(E==p||E==y||E==z)){var K=x[C[E]].x,X=x[C[E]].y,D=void 0,R=void 0,T=void 0,V=void 0,W=void 0,o=void 0,ha=void 0,S=void 0,ma=void 0,ca=void 0,ra=void 0,la=void 0,D=T=W=void 0,D=J-M,R=I-Q,T=G-J,V=H-I,W=M-G,o=Q-H,ha=K-G,S=X-H,ma=K-M,ca=X-Q,ra=K-J,la=X-I,D=D*ca-R*ma,W=W*S-o*ha,T=T*la-V*ra;if(D>=0&&T>=0&&W>=0){x=!1;
|
|
|
break a}}x=!0}}if(x){m.push([b[k[t]],b[k[u]],b[k[w]]]);n.push([k[t],k[u],k[w]]);t=u;for(w=u+1;w<h;t++,w++)k[t]=k[w];h--;v=2*h}}if(f)return n;return m};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 m=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(m);h.y=this.radius*Math.sin(m);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(m);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(m);n.z=
|
|
|
this.tube*Math.sin(k);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,m=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,t=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[m]);t.normal.addSelf(c[k]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
|
|
@@ -535,12 +535,12 @@ c.postMessage(b)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,t=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?m&&(t==0&&(t=k.getResponseHeader("Content-Length")),m({total:t,loaded:k.responseText.length})):k.readyState==2&&(t=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
k.setRequestHeader("Content-Type","text/plain");k.send(null)};
|
|
|
THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=w(b,c),h=w(b,c+1),k=w(b,c+2),m=w(b,c+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,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function u(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function v(c){var e,
|
|
|
-f,k;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var v=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,
|
|
|
-c+V);c=t(b,c+X);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,v,u,w;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,c+V);p=t(b,c+X);v=h(b,c+o);u=h(b,c+ha);w=h(b,c+S);c=h(b,c+ma);p=C.materials[p];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var O=H[w*3],ga=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(O,ga,w),new THREE.Vector3(y,z,c)],null,p))}
|
|
|
+f,k;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+X);c=h(b,c+D);m=C.materials[m];var v=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,
|
|
|
+c+V);c=t(b,c+W);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,v,u,w;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,c+V);p=t(b,c+W);v=h(b,c+o);u=h(b,c+ha);w=h(b,c+S);c=h(b,c+ma);p=C.materials[p];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var O=H[w*3],ga=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(O,ga,w),new THREE.Vector3(y,z,c)],null,p))}
|
|
|
function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ca);k=h(b,c+ra);c=M[e*2];m=M[e*2+1];e=M[f*2];var o=C.faceVertexUvs[0];f=M[f*2+1];var p=M[k*2];k=M[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+la);k=h(b,c+pa);m=h(b,c+fa);c=M[e*2];o=M[e*2+1];e=M[f*2];p=M[f*2+1];f=M[k*2];var t=C.faceVertexUvs[0];k=M[k*2+1];var v=M[m*2];m=M[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f,
|
|
|
-k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],M=[],Q,J,I,K,W,D,R,T,V,X,o,ha,S,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={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+=G.header_bytes;Q=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;W=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes;
|
|
|
-T=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;X=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ha=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ma=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;ra=G.uv_index_bytes*2;la=G.uv_index_bytes;pa=G.uv_index_bytes*2;fa=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
|
|
|
+k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],M=[],Q,J,I,K,X,D,R,T,V,W,o,ha,S,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={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+=G.header_bytes;Q=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;X=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes;
|
|
|
+T=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;W=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ha=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ma=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;ra=G.uv_index_bytes*2;la=G.uv_index_bytes;pa=G.uv_index_bytes*2;fa=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
|
|
|
4+G.material_index_bytes;ia=G.ntri_flat*c;U=G.ntri_smooth*(c+G.normal_index_bytes*3);$=G.ntri_flat_uv*(c+G.uv_index_bytes*3);da=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ja=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+G.vertex_coordinate_bytes),m=e(b,c+G.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
h,m)));return G.nvertices*n}(E);E+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=u(b,c),f=u(b,c+G.normal_coordinate_bytes),h=u(b,c+G.normal_coordinate_bytes*2),H.push(e/127,f/127,h/127);return G.nnormals*k}(E);E+=function(c){for(var f,h,m=G.uv_coordinate_bytes*2,n=c+G.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+G.uv_coordinate_bytes),M.push(f,h);return G.nuvs*m}(E);ia=E+ia;U=ia+U;$=U+$;da=$+da;ja=da+ja;c=ja+c;sa=c+sa;(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,
|
|
|
f=e+G.uv_index_bytes*3,h=b+G.ntri_flat_uv*f;for(c=b;c<h;c+=f)v(c),z(c+e);return h-b})(U);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=e+G.uv_index_bytes*3,h=b+G.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),z(c+e);return h-b})($);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=e+G.uv_index_bytes*4,h=b+G.nquad_flat_uv*f;for(c=b;c<h;c+=f)p(c),A(c+e);return h-b})(c);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*
|
|
@@ -556,8 +556,8 @@ u.material;t++}o=v||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.
|
|
|
else{t=t.morph;for(u=0;u<t.targets.length;u++){var w=ea[t.targets[u]];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_"+va.length;va.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
|
|
|
this.id=""}function k(){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 u(){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 v(){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 z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
|
|
|
-this.stride=this.count=0;this.params=[]}function H(){this.input={}}function M(){this.semantic="";this.offset=0;this.source="";this.set=0}function Q(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function I(){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 K(b,c){this.type=b;this.effect=c;this.material=null}function W(b){this.effect=b;this.format=this.init_from=
|
|
|
-null}function D(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 T(){this.url=""}function V(){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.stride=this.count=0;this.params=[]}function H(){this.input={}}function M(){this.semantic="";this.offset=0;this.source="";this.set=0}function Q(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function I(){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 K(b,c){this.type=b;this.effect=c;this.material=null}function X(b){this.effect=b;this.format=this.init_from=
|
|
|
+null}function D(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 T(){this.url=""}function V(){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 ha(b){var c=b.getAttribute("id");if(da[c]!=void 0)return da[c];da[c]=(new Q(c)).parse(b);return da[c]}function S(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ra(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function ca(b){for(var b=ra(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ra(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
"").split(/\s+/)}function la(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function pa(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function fa(b,c){var e="";e+=pa(b.x,c)+",";e+=pa(b.y,c)+",";e+=pa(b.z,c);return e}var ia=null,U=null,$,da={},ja={},sa={},N={},ea={},qa={},ua={},ta,Ba=null,Ca,va,Aa,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
|
|
|
b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new t).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
|
|
@@ -589,12 +589,12 @@ e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]
|
|
|
function(){return this.texture!=null};I.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ma(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==
|
|
|
1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new I).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=ia.evaluate(".//dae:float",e,S,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[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&&
|
|
|
this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ja[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());
|
|
|
-break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};W.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};D.prototype.parse=
|
|
|
+break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};X.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};D.prototype.parse=
|
|
|
function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.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 c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};R.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new W(this)).parse(f);
|
|
|
+null)return null};R.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};R.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new X(this)).parse(f);
|
|
|
this.surface.sid=c;break;case "sampler2D":this.sampler=(new D(this)).parse(f);this.sampler.sid=c;break;case "extra":break;default:console.log(f.nodeName)}}};R.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};R.prototype.parseTechnique=
|
|
|
function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(e.nodeName,this)).parse(e)}}};T.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};V.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=
|
|
|
-(new Q).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new X(this)).parse(e))}}return this};X.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=
|
|
|
+(new Q).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new W(this)).parse(e))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=
|
|
|
parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;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 c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new M).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
|
|
|
e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.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)){Ba=f;var o,p=e;ia=n.responseXML;o=Ba;p!==void 0&&(p=p.split("/"),p.pop(),Ca=p.join("/")+"/");ja=b("//dae:library_images/dae:image",m,"image");qa=b("//dae:library_materials/dae:material",
|
|
@@ -607,17 +607,17 @@ new THREE.UV(G,y);f.faceVertexUvs[e][t]=E}if(p)p=H[u++]*3,h=new THREE.Vector3,h.
|
|
|
t,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],t=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,t,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,t,u,w,v,x,p,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];p=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;t=0;for(u=y.length;t<u;t+=3)w=y[t]*c,v=y[t+1]*
|
|
|
c,x=y[t+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(w,v,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];u=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(t=w.length;c<t;c+=3)v=new THREE.Color(16755200),v.setRGB(w[c],w[c+1],w[c+2]),u.push(v)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
f.vertices[h],e,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,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(p in R.objects)if(!S.objects[p])if(E=R.objects[p],E.geometry!==void 0){if(Q=S.geometries[E.geometry]){var b=!1;W=[];for(ca=0;ca<E.materials.length;ca++)W[ca]=S.materials[E.materials[ca]],b=W[ca]instanceof THREE.ShaderMaterial;b&&Q.computeTangents();G=E.position;r=E.rotation;
|
|
|
-q=E.quaternion;s=E.scale;q=0;W.length==0&&(W[0]=new THREE.MeshFaceMaterial);W.length>1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,W);object.name=p;object.position.set(G[0],G[1],G[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;S.scene.addObject(object);S.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
|
|
|
+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,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(p in R.objects)if(!S.objects[p])if(E=R.objects[p],E.geometry!==void 0){if(Q=S.geometries[E.geometry]){var b=!1;X=[];for(ca=0;ca<E.materials.length;ca++)X[ca]=S.materials[E.materials[ca]],b=X[ca]instanceof THREE.ShaderMaterial;b&&Q.computeTangents();G=E.position;r=E.rotation;
|
|
|
+q=E.quaternion;s=E.scale;q=0;X.length==0&&(X[0]=new THREE.MeshFaceMaterial);X.length>1&&(X=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,X);object.name=p;object.position.set(G[0],G[1],G[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;S.scene.addObject(object);S.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
|
|
|
if(E.castsShadow)b=new THREE.ShadowVolume(Q),S.scene.addChild(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},S.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(G[0],G[1],G[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,S.scene.addObject(object),S.objects[p]=object,S.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}function t(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){S.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ha,loadedModels:o-V,loadedTextures:ha-X},S);e.onLoadProgress();V==0&&X==0&&c(S)}
|
|
|
-var v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K,W,D,R,T,V,X,o,ha,S;R=b.data;K=new THREE.BinaryLoader;T=new THREE.JSONLoader;X=V=0;S={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)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);H&&S.scene.rotation.set(H[0],
|
|
|
-H[1],H[2]);ma&&S.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&S.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in R.cameras){H=R.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);S.cameras[z]=J}for(y in R.lights)z=R.lights[y],
|
|
|
+s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,S.scene.addObject(object),S.objects[p]=object,S.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}function t(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){S.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ha,loadedModels:o-V,loadedTextures:ha-W},S);e.onLoadProgress();V==0&&W==0&&c(S)}
|
|
|
+var v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K,X,D,R,T,V,W,o,ha,S;R=b.data;K=new THREE.BinaryLoader;T=new THREE.JSONLoader;W=V=0;S={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)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);H&&S.scene.rotation.set(H[0],
|
|
|
+H[1],H[2]);ma&&S.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&S.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in R.cameras){H=R.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);S.cameras[z]=J}for(y in R.lights)z=R.lights[y],
|
|
|
J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),S.scene.addLight(D),S.lights[y]=D;for(A in R.fogs)y=R.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
|
|
|
y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),S.fogs[A]=I;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];H=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(H[0],H[1],H[2]);S.bgColorAlpha=R.defaults.bgalpha;for(v in R.geometries)if(A=R.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(v in R.geometries)A=R.geometries[v],A.type=="cube"?(Q=new THREE.CubeGeometry(A.width,
|
|
|
A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[v]=Q):A.type=="plane"?(Q=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="sphere"?(Q=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="cylinder"?(Q=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[v]=Q):A.type=="torus"?(Q=new THREE.TorusGeometry(A.radius,A.tube,
|
|
|
-A.segmentsR,A.segmentsT),S.geometries[v]=Q):A.type=="icosahedron"?(Q=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[v]=Q):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?T.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&T.createModel(A,u(v),"");for(C in R.textures)if(v=R.textures[C],v.url instanceof Array){X+=v.url.length;for(K=0;K<v.url.length;K++)e.onLoadStart()}else X+=1,e.onLoadStart();ha=
|
|
|
-X;for(C in R.textures){v=R.textures[C];if(v.mapping!=void 0&&THREE[v.mapping]!=void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){K=[];for(var ca=0;ca<v.url.length;ca++)K[ca]=f(v.url[ca],R.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,v.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(v.url,R.urlBaseType),v.mapping,b);if(THREE[v.minFilter]!=void 0)K.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)K.magFilter=THREE[v.magFilter];if(v.repeat){K.repeat.set(v.repeat[0],v.repeat[1]);
|
|
|
+A.segmentsR,A.segmentsT),S.geometries[v]=Q):A.type=="icosahedron"?(Q=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[v]=Q):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?T.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&T.createModel(A,u(v),"");for(C in R.textures)if(v=R.textures[C],v.url instanceof Array){W+=v.url.length;for(K=0;K<v.url.length;K++)e.onLoadStart()}else W+=1,e.onLoadStart();ha=
|
|
|
+W;for(C in R.textures){v=R.textures[C];if(v.mapping!=void 0&&THREE[v.mapping]!=void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){K=[];for(var ca=0;ca<v.url.length;ca++)K[ca]=f(v.url[ca],R.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,v.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(v.url,R.urlBaseType),v.mapping,b);if(THREE[v.minFilter]!=void 0)K.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)K.magFilter=THREE[v.magFilter];if(v.repeat){K.repeat.set(v.repeat[0],v.repeat[1]);
|
|
|
if(v.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(v.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}v.offset&&K.offset.set(v.offset[0],v.offset[1]);if(v.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[v.wrap[0]]!==void 0)K.wrapS=T[v.wrap[0]];if(T[v.wrap[1]]!==void 0)K.wrapT=T[v.wrap[1]]}}S.textures[C]=K}for(x in R.materials){C=R.materials[x];for(M in C.parameters)if(M=="envMap"||M=="map"||M=="lightMap")C.parameters[M]=S.textures[C.parameters[M]];else if(M=="shading")C.parameters[M]=
|
|
|
C.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")C.parameters[M]=THREE[C.parameters[M]]?THREE[C.parameters[M]]:THREE.NormalBlending;else if(M=="combine")C.parameters[M]=C.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(C.parameters[M]=="face")C.parameters[M]=THREE.FaceColors;else if(C.parameters[M])C.parameters[M]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=
|
|
|
!0;if(C.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(v.uniforms);K=C.parameters.color;T=C.parameters.specular;A=C.parameters.ambient;I=C.parameters.shininess;b.tNormal.texture=S.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
|
|
@@ -626,15 +626,15 @@ THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.const
|
|
|
THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,m=b.offsetX!==void 0?b.offsetX:0,k=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,m,k,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 m=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);m+=n>>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h<c;h++)n=b.charCodeAt(h+f),m[h]=k-n,n==0&&k++;return[e,m]};
|
|
|
THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),u=[],w=[];(function(b,k,p){for(var t,u,w,C=b.length;p<C;p+=k)t=b[p],u=b[p+1],w=b[p+2],t=t/16383*e,u=u/16383*e,w=w/16383*e,t+=f,u+=h,w+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,w)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,w.push(f,1-h)})(k[0],8,3);(function(b,
|
|
|
-c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,t,E,G,H,M=b.length;for(e=0;e<M;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;H=h;t=k;E=f;var Q=h,J=k,I=m.materials[0],K=u[Q*3],W=u[Q*3+1],Q=u[Q*3+2],D=u[J*3],R=u[J*3+1],J=u[J*3+2];E=new THREE.Vector3(u[E*3],u[E*3+1],u[E*3+2]);Q=new THREE.Vector3(K,W,Q);J=new THREE.Vector3(D,R,J);m.faces.push(new THREE.Face3(G,H,t,[E,Q,J],null,I));m=w[f*2];f=w[f*2+
|
|
|
+c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,t,E,G,H,M=b.length;for(e=0;e<M;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;H=h;t=k;E=f;var Q=h,J=k,I=m.materials[0],K=u[Q*3],X=u[Q*3+1],Q=u[Q*3+2],D=u[J*3],R=u[J*3+1],J=u[J*3+2];E=new THREE.Vector3(u[E*3],u[E*3+1],u[E*3+2]);Q=new THREE.Vector3(K,X,Q);J=new THREE.Vector3(D,R,J);m.faces.push(new THREE.Face3(G,H,t,[E,Q,J],null,I));m=w[f*2];f=w[f*2+
|
|
|
1];t=w[h*2];E=w[h*2+1];G=w[k*2];H=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(G,H));k.push(E)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
|
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
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,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=t;c[m+2]=u;h[m]=this.lerp(w[b],w[b+3],k);h[m+1]=this.lerp(w[b+1],w[b+4],k);h[m+2]=this.lerp(w[b+2],w[b+5],k)};this.VIntY=function(b,c,h,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n;c[m+1]=t+k*this.delta;c[m+
|
|
|
2]=u;c=b+this.yd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n;c[m+1]=t;c[m+2]=u+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};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,m,k,n){var t=m+1,u=m+this.yd,w=m+this.zd,v=t+this.yd,x=t+this.zd,p=m+this.yd+this.zd,y=t+this.yd+this.zd,z=0,A=this.field[m],C=this.field[t],E=this.field[u],G=this.field[v],H=this.field[w],M=this.field[x],Q=this.field[p],J=this.field[y];A<k&&(z|=1);C<k&&(z|=2);E<k&&(z|=8);G<k&&(z|=4);H<k&&(z|=16);M<k&&(z|=32);Q<k&&(z|=128);J<k&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;var K=this.delta,
|
|
|
-W=b+K,D=c+K,K=h+K;I&1&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,C));I&2&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,3,k,W,c,h,C,G));I&4&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,6,k,b,D,h,E,G));I&8&&(this.compNorm(m),this.compNorm(u),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,E));I&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,K,H,M));I&32&&(this.compNorm(x),
|
|
|
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,W,c,K,M,J));I&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,k,b,D,K,Q,J));I&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,K,H,Q));I&256&&(this.compNorm(m),this.compNorm(w),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,H));I&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,k,W,c,h,C,M));I&1024&&(this.compNorm(v),this.compNorm(y),this.VIntZ(v*
|
|
|
-3,this.vlist,this.nlist,30,k,W,D,h,G,J));I&2048&&(this.compNorm(u),this.compNorm(p),this.VIntZ(u*3,this.vlist,this.nlist,33,k,b,D,h,E,Q));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+k,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),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,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[m];this.positionArray[t+
|
|
|
+X=b+K,D=c+K,K=h+K;I&1&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,C));I&2&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,3,k,X,c,h,C,G));I&4&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,6,k,b,D,h,E,G));I&8&&(this.compNorm(m),this.compNorm(u),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,E));I&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,K,H,M));I&32&&(this.compNorm(x),
|
|
|
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,X,c,K,M,J));I&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,k,b,D,K,Q,J));I&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,K,H,Q));I&256&&(this.compNorm(m),this.compNorm(w),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,H));I&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,k,X,c,h,C,M));I&1024&&(this.compNorm(v),this.compNorm(y),this.VIntZ(v*
|
|
|
+3,this.vlist,this.nlist,30,k,X,D,h,G,J));I&2048&&(this.compNorm(u),this.compNorm(p),this.VIntZ(u*3,this.vlist,this.nlist,33,k,b,D,h,E,Q));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+k,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),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,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[m];this.positionArray[t+
|
|
|
4]=b[m+1];this.positionArray[t+5]=b[m+2];this.positionArray[t+6]=b[k];this.positionArray[t+7]=b[k+1];this.positionArray[t+8]=b[k+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[m];this.normalArray[t+4]=c[m+1];this.normalArray[t+5]=c[m+2];this.normalArray[t+6]=c[k];this.normalArray[t+7]=c[k+1];this.normalArray[t+8]=c[k+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,m,k){var n=this.size*Math.sqrt(m/k),t=h*this.size,u=c*this.size,w=b*this.size,v=Math.floor(t-n);v<1&&(v=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=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,z,A,C,E,G;v<t;v++){w=this.size2*v;z=v/this.size-h;E=z*z;for(z=x;z<u;z++){A=w+this.size*z;y=z/this.size-c;G=y*y;for(y=p;y<n;y++)C=y/this.size-b,C=m/(1.0E-6+C*C+G+E)-k,C>0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,u=this.size,w=this.yd,v=this.zd,x=this.field,p=u*Math.sqrt(b/c);p>u&&(p=u);for(h=0;h<p;h++)if(m=h/u,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<u;m++){t=h+m*w;for(k=0;k<u;k++)x[v*k+t]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,t,u,w=this.size,v=this.yd,x=
|